pub trait PreHashMapExt<K, V> {
// Required method
fn get_or_insert_with<F: FnOnce() -> V>(
&mut self,
key: &Hashed<K>,
func: F,
) -> &mut V;
}
Expand description
Extension methods intended to add functionality to PreHashMap
.
Required Methods§
Sourcefn get_or_insert_with<F: FnOnce() -> V>(
&mut self,
key: &Hashed<K>,
func: F,
) -> &mut V
fn get_or_insert_with<F: FnOnce() -> V>( &mut self, key: &Hashed<K>, func: F, ) -> &mut V
Tries to get or insert the value for the given key
using the pre-computed hash first.
If the PreHashMap
does not already contain the key
, it will clone it and insert
the value returned by func
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.