Closed
Description
Would it be possible to add a function that allows an entry to be remove based on a key hash and a closure, sort of like how RawEntryBuilder::from_hash()
works?
I'm having some trouble with a piece of code that uses a stored key hash to manipulate a HashMap
. Simplified, I need to remove an entry from a HashMap
, but I do not have access to the entry's key. However, I do have access to its hash and its value (which is uniquely identifiable). Something like this would be perfect:
map.remove_by_hash(key_hash, |_k, v| {
*v == the_value_i_am_looking_for
});
I run into trouble if I try to translate the key hash to a key reference by via raw_entry()
, then from_hash()
, and finally use the regular remove()
method because the returned reference to the key will disallow mutable access to the HashMap
.
Metadata
Metadata
Assignees
Labels
No labels