aboutsummaryrefslogtreecommitdiff
path: root/src/makefile/target.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/makefile/target.rs')
-rw-r--r--src/makefile/target.rs19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/makefile/target.rs b/src/makefile/target.rs
index 5de280d..8f56506 100644
--- a/src/makefile/target.rs
+++ b/src/makefile/target.rs
@@ -148,31 +148,32 @@ impl Into<HashMap<String, Target>> for StaticTargetSet {
// for targets that might become updated and so need refcelling
#[derive(Clone, Default)]
pub struct DynamicTargetSet {
- data: HashMap<String, Rc<RefCell<Target>>>,
+ data: RefCell<HashMap<String, Rc<RefCell<Target>>>>,
}
impl DynamicTargetSet {
pub fn get(&self, name: &str) -> Option<Rc<RefCell<Target>>> {
- self.data.get(name).map(|x| Rc::clone(x))
+ self.data.borrow().get(name).map(|x| Rc::clone(x))
}
- pub fn put(&mut self, target: Target) {
- if let Some(existing_target) = self.data.get_mut(&target.name) {
+ pub fn put(&self, target: Target) {
+ if let Some(existing_target) = self.data.borrow().get(&target.name) {
existing_target.borrow_mut().extend(target);
- } else {
- self.data
- .insert(target.name.clone(), Rc::new(RefCell::new(target)));
+ return;
}
+ self.data
+ .borrow_mut()
+ .insert(target.name.clone(), Rc::new(RefCell::new(target)));
}
pub fn has(&self, name: &str) -> bool {
- self.data.contains_key(name)
+ self.data.borrow().contains_key(name)
}
}
impl fmt::Display for DynamicTargetSet {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- for target in self.data.values() {
+ for target in self.data.borrow().values() {
writeln!(f, "{}", target.borrow())?;
}
Ok(())