pub trait TypeIdHashMapExt<V> {
// Required methods
fn insert_type<T>(&mut self, v: V) -> Option<V>
where T: 'static + ?Sized;
fn get_type<T>(&self) -> Option<&V>
where T: 'static + ?Sized;
fn get_type_mut<T>(&mut self) -> Option<&mut V>
where T: 'static + ?Sized;
fn remove_type<T>(&mut self) -> Option<V>
where T: 'static + ?Sized;
fn entry_type<T>(&mut self) -> Entry<'_, TypeId, V, NoOpHash>
where T: 'static + ?Sized;
}Expand description
Extension trait to make use of TypeIdHashMap more ergonomic.
Required Methods§
Sourcefn insert_type<T>(&mut self, v: V) -> Option<V>where
T: 'static + ?Sized,
fn insert_type<T>(&mut self, v: V) -> Option<V>where
T: 'static + ?Sized,
Inserts a value for the type T.
If the map did not previously contain this key then None is returned,
otherwise the value for this key is updated and the old value returned.
Sourcefn get_type<T>(&self) -> Option<&V>where
T: 'static + ?Sized,
fn get_type<T>(&self) -> Option<&V>where
T: 'static + ?Sized,
Returns a reference to the value for type T, if one exists.
Sourcefn get_type_mut<T>(&mut self) -> Option<&mut V>where
T: 'static + ?Sized,
fn get_type_mut<T>(&mut self) -> Option<&mut V>where
T: 'static + ?Sized,
Returns a mutable reference to the value for type T, if one exists.
Sourcefn remove_type<T>(&mut self) -> Option<V>where
T: 'static + ?Sized,
fn remove_type<T>(&mut self) -> Option<V>where
T: 'static + ?Sized,
Removes type T from the map, returning the value for this
key if it was previously present.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".