diff --git a/src/libstd/collections/hashmap.rs b/src/libstd/collections/hashmap.rs index 7c01a0342edc7..2aa4d3fca0f3e 100644 --- a/src/libstd/collections/hashmap.rs +++ b/src/libstd/collections/hashmap.rs @@ -1361,6 +1361,19 @@ impl, V, S, H: Hasher> HashMap { } } + /// Return the (mutable) value corresponding to the key in the map, using + /// equivalence. + pub fn find_mut_equiv<'a, Q: Hash + Equiv>(&'a mut self, k: &Q + ) -> Option<&'a mut V> { + match self.search_equiv(k) { + Some(idx) => { + let (_, v_ref) = self.table.read_mut(&idx); + Some(v_ref) + } + None => None + } + } + /// An iterator visiting all keys in arbitrary order. /// Iterator element type is &'a K. pub fn keys<'a>(&'a self) -> Keys<'a, K, V> {