Closed
Description
I found myself needing a partially mutable version of HashMap::get_key_value
, with the following signature:
pub fn get_key_value_mut<Q: ?Sized>(&mut self, k: &Q) -> Option<(&K, &mut V)> where
K: Borrow<Q>,
Q: Hash + Eq,
Obviously I was looking at std
, and I think I cannot obtain nothing similar without the unstable hash_raw_entry
API. However, hashbrown
currently supports the API, therefore it should be pretty straightforward to implement the new feature.
The only thing I am still doubtful is the possibility of creating of an inconsistent state with the proposed API. At first glance, it should not be possible to smash the state of the hashmap, but maybe I am missing something. What do you think?
Metadata
Metadata
Assignees
Labels
No labels