2013-09-29 16:46:23 -05:00
|
|
|
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2014-03-05 17:28:08 -06:00
|
|
|
|
2013-12-28 14:24:15 -06:00
|
|
|
pub struct CrateId {
|
2014-05-22 18:57:53 -05:00
|
|
|
local_path: String,
|
|
|
|
junk: String
|
2013-09-29 16:46:23 -05:00
|
|
|
}
|
|
|
|
|
2013-12-28 14:24:15 -06:00
|
|
|
impl CrateId {
|
|
|
|
fn new(s: &str) -> CrateId {
|
|
|
|
CrateId {
|
2014-05-25 05:17:19 -05:00
|
|
|
local_path: s.to_string(),
|
|
|
|
junk: "wutevs".to_string()
|
2013-09-29 16:46:23 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn remove_package_from_database() {
|
2016-03-17 03:15:06 -05:00
|
|
|
let mut lines_to_use: Vec<&CrateId> = Vec::new(); //~ ERROR E0495
|
2015-02-01 11:44:15 -06:00
|
|
|
let push_id = |installed_id: &CrateId| {
|
2013-09-29 16:46:23 -05:00
|
|
|
lines_to_use.push(installed_id);
|
|
|
|
};
|
|
|
|
list_database(push_id);
|
|
|
|
|
2015-01-31 11:20:46 -06:00
|
|
|
for l in &lines_to_use {
|
2013-10-13 20:48:47 -05:00
|
|
|
println!("{}", l.local_path);
|
2013-09-29 16:46:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-01-03 09:45:00 -06:00
|
|
|
pub fn list_database<F>(mut f: F) where F: FnMut(&CrateId) {
|
2013-09-29 16:46:23 -05:00
|
|
|
let stuff = ["foo", "bar"];
|
|
|
|
|
2015-01-31 11:20:46 -06:00
|
|
|
for l in &stuff {
|
2013-12-28 14:24:15 -06:00
|
|
|
f(&CrateId::new(*l));
|
2013-09-29 16:46:23 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
remove_package_from_database();
|
|
|
|
}
|