auto merge of #6867 : Dretch/rust/hashmap_get_mut, r=nikomatsakis

This commit is contained in:
bors 2013-06-02 09:16:40 -07:00
commit 077ca79941

View File

@ -501,6 +501,15 @@ pub fn get<'a>(&'a self, k: &K) -> &'a V {
}
}
/// Retrieves a (mutable) value for the given key, failing if the key
/// is not present.
pub fn get_mut<'a>(&'a mut self, k: &K) -> &'a mut V {
match self.find_mut(k) {
Some(v) => v,
None => fail!("No entry found for key: %?", k),
}
}
/// Return true if the map contains a value for the specified key,
/// using equivalence
pub fn contains_key_equiv<Q:Hash + Equiv<K>>(&self, key: &Q) -> bool {