Are there any obstructions to {Hash, BTree}Map
implementing the following method?
fn occupied_entry(&mut self, key: &K) -> Option<OccupiedEntry>
As far as I can tell, the reason entry()
needs to take the key by value is for the vacant case. The advantage of this over get_mut()
is if you potentially need to remove that entry, since remove()
returns an Option<V>
and also requires a second lookup, while OccupiedEntry::remove()
returns a V
.