pub struct CtxMap { /* private fields */ }
Expand description
A map that holds at most one value of any type.
This is similar to the type provided by the anymap
crate, but we can get away with simpler
types on the methods due to our more specialized use case.
Implementations§
Source§impl CtxMap
impl CtxMap
pub fn clear(&mut self)
pub fn contains<T: Any>(&self) -> bool
pub fn try_get<T: Any>(&self) -> Option<Result<Ref<'_, T>, BorrowError>>
pub fn try_get_mut<T: Any>( &self, ) -> Option<Result<RefMut<'_, T>, BorrowMutError>>
pub fn insert<T: Any>(&mut self, x: T) -> Option<T>
pub fn remove<T: Any>(&mut self) -> Option<T>
pub fn new() -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CtxMap
impl !RefUnwindSafe for CtxMap
impl !Send for CtxMap
impl !Sync for CtxMap
impl Unpin for CtxMap
impl !UnwindSafe for CtxMap
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