// switch to persistent hash maps if we can at some point or otherwise
// make these much cheaper to clone in general.
pub activations: Activations,
- pub resolve_features: HashMap<PackageId, HashSet<InternedString>>,
+ pub resolve_features: HashMap<PackageId, Rc<HashSet<InternedString>>>,
pub links: HashMap<InternedString, PackageId>,
// These are two cheaply-cloneable lists (O(1) clone) which are effectively
pub warnings: RcList<String>,
}
+pub type Activations = HashMap<(InternedString, SourceId), Rc<Vec<Summary>>>;
+
impl Context {
pub fn new() -> Context {
Context {
let set = self.resolve_features
.entry(pkgid.clone())
- .or_insert_with(HashSet::new);
+ .or_insert_with(|| Rc::new(HashSet::new()));
+
+ let mut inner: HashSet<_> = (**set).clone();
for feature in reqs.used {
- set.insert(InternedString::new(feature));
+ inner.insert(InternedString::new(feature));
}
+ *set = Rc::new(inner);
}
Ok(ret)
}
}
}
-
-pub type Activations = HashMap<(InternedString, SourceId), Rc<Vec<Summary>>>;