Struct typemap::TypeMap [−][src]
pub struct TypeMap<A: ?Sized = dyn UnsafeAny> where
A: UnsafeAnyExt, { /* fields omitted */ }
Expand description
A map keyed by types.
Can contain one value of any type for each key type, as defined by the Assoc trait.
You usually do not need to worry about the A type parameter, but it
can be used to add bounds to the possible value types that can
be stored in this map. Usually, you are looking for ShareMap
, which
is Send + Sync
.
Implementations
Create a new, empty TypeMap.
Can be used with any A
parameter; new
is specialized to get around
the required type annotations when using this function.
Insert a value into the map with a specified key type.
Find a value in the map and get a reference to it.
Find a value in the map and get a mutable reference to it.
Check if a key has an associated value stored in the map.
Remove a value from the map.
Returns true
if a value was removed.
Get the given key’s corresponding entry in the map for in-place manipulation.
Get a mutable reference to the underlying HashMap
Trait Implementations
Auto Trait Implementations
impl<A: ?Sized> RefUnwindSafe for TypeMap<A> where
A: RefUnwindSafe,
impl<A: ?Sized> UnwindSafe for TypeMap<A> where
A: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more