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() {
|
2014-06-03 14:38:00 -05:00
|
|
|
let mut lines_to_use: Vec<&CrateId> = Vec::new();
|
2015-01-03 09:45:00 -06:00
|
|
|
let push_id = |&mut: installed_id: &CrateId| {
|
2013-09-29 16:46:23 -05:00
|
|
|
lines_to_use.push(installed_id);
|
2014-06-03 14:38:00 -05:00
|
|
|
//~^ ERROR cannot infer an appropriate lifetime for automatic coercion due to
|
|
|
|
// conflicting requirements
|
2013-09-29 16:46:23 -05:00
|
|
|
};
|
|
|
|
list_database(push_id);
|
|
|
|
|
|
|
|
for l in lines_to_use.iter() {
|
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"];
|
|
|
|
|
|
|
|
for l in stuff.iter() {
|
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();
|
|
|
|
}
|