pub trait HashMapExt<K, V> {
// Required method
fn try_insert_ext(
&mut self,
k: K,
v: V,
) -> Option<(V, OccupiedEntry<'_, K, V>)>;
}Expand description
Extension trait for HashMap<K, V>.
Required Methods§
Sourcefn try_insert_ext(&mut self, k: K, v: V) -> Option<(V, OccupiedEntry<'_, K, V>)>
fn try_insert_ext(&mut self, k: K, v: V) -> Option<(V, OccupiedEntry<'_, K, V>)>
Like insert, but if the insertion fails then it returns the value
that it attempted to insert, as well as an OccupiedEntry containing
the other value that was found.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".