pub struct TypeMap<A = dyn UnsafeAny>where
A: UnsafeAnyExt + ?Sized,{ /* private fields */ }
Implementations§
Source§impl<A: UnsafeAnyExt + ?Sized> TypeMap<A>
impl<A: UnsafeAnyExt + ?Sized> TypeMap<A>
Sourcepub fn custom() -> TypeMap<A>
pub fn custom() -> TypeMap<A>
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.
Sourcepub fn put<K: Key>(&mut self, val: K::Value) -> Option<K::Value>
pub fn put<K: Key>(&mut self, val: K::Value) -> Option<K::Value>
Insert a value into the map with a specified key type.
Sourcepub fn get<K: Key>(&self) -> &K::Value
pub fn get<K: Key>(&self) -> &K::Value
Gets a value from the type map.
§Panics
If there is no value in the request state of the given type.
Trait Implementations§
Auto Trait Implementations§
impl<A> Freeze for TypeMap<A>where
A: ?Sized,
impl<A> RefUnwindSafe for TypeMap<A>where
A: RefUnwindSafe + ?Sized,
impl<A> Send for TypeMap<A>
impl<A> Sync for TypeMap<A>
impl<A> Unpin for TypeMap<A>where
A: ?Sized,
impl<A> UnwindSafe for TypeMap<A>where
A: UnwindSafe + ?Sized,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more