pub struct TypeMap { /* private fields */ }
Expand description
The typemap container
Implementations§
Source§impl TypeMap
impl TypeMap
Sourcepub fn insert_kv_pair(&mut self, KvPair: KvPair) -> Option<KvPair>
pub fn insert_kv_pair(&mut self, KvPair: KvPair) -> Option<KvPair>
Insert a prepared KvPair
into this TypeMap
.
If a value of this type already exists, it will be returned.
Sourcepub fn insert<T: Send + Sync + 'static>(&mut self, val: T) -> Option<T>
pub fn insert<T: Send + Sync + 'static>(&mut self, val: T) -> Option<T>
Insert a value into this TypeMap
.
If a value of this type already exists, it will be returned.
Sourcepub fn get<T: 'static>(&self) -> Option<&T>
pub fn get<T: 'static>(&self) -> Option<&T>
Get a reference to a value previously inserted on this TypeMap
.
Sourcepub fn get_mut<T: 'static>(&mut self) -> Option<&mut T>
pub fn get_mut<T: 'static>(&mut self) -> Option<&mut T>
Get a mutable reference to a value previously inserted on this TypeMap
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TypeMap
impl !RefUnwindSafe for TypeMap
impl Send for TypeMap
impl Sync for TypeMap
impl Unpin for TypeMap
impl !UnwindSafe for TypeMap
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