pub struct TyghtMap<S>(/* private fields */);Expand description
A static type map.
See the crate-level documentation for more information.
Implementations§
source§impl<S> TyghtMap<S>
impl<S> TyghtMap<S>
sourcepub fn try_insert<T>(self, item: T) -> (Option<T>, TyghtMap<S::Inserted>)where
S: MaybeContains<T>,
pub fn try_insert<T>(self, item: T) -> (Option<T>, TyghtMap<S::Inserted>)where
S: MaybeContains<T>,
Tries to insert a value. If a value, with the same type, already exists then replace and return it.
This consumes the map then returns an (item, map) pair, where item is the existing item in the map.
sourcepub fn insert<T>(self, item: T) -> TyghtMap<S::Inserted>where
S: Missing<T>,
pub fn insert<T>(self, item: T) -> TyghtMap<S::Inserted>where
S: Missing<T>,
Inserts a value.
This consumes then returns the map.
sourcepub fn get<T>(&self) -> &Twhere
S: Contains<T>,
pub fn get<T>(&self) -> &Twhere
S: Contains<T>,
Returns a reference to a value with a given type.
sourcepub fn try_get<T>(&self) -> Option<&T>where
S: MaybeContains<T>,
pub fn try_get<T>(&self) -> Option<&T>where
S: MaybeContains<T>,
Tries to return a reference to a value with a given type.
sourcepub fn get_mut<T>(&mut self) -> &mut Twhere
S: Contains<T>,
pub fn get_mut<T>(&mut self) -> &mut Twhere
S: Contains<T>,
Returns a mutable reference to a value with a given type.
sourcepub fn try_get_mut<T>(&mut self) -> Option<&mut T>where
S: MaybeContains<T>,
pub fn try_get_mut<T>(&mut self) -> Option<&mut T>where
S: MaybeContains<T>,
Tries to return a reference to a value with a given type.
sourcepub fn remove<T>(self) -> (T, TyghtMap<S::Removed>)where
S: Contains<T>,
pub fn remove<T>(self) -> (T, TyghtMap<S::Removed>)where
S: Contains<T>,
Removes a value with a given type.
This consumes the map and returns an (item, map) pair.
sourcepub fn try_remove<T>(self) -> (Option<T>, TyghtMap<S::Removed>)where
S: MaybeContains<T>,
pub fn try_remove<T>(self) -> (Option<T>, TyghtMap<S::Removed>)where
S: MaybeContains<T>,
Tries to remove a value with a given type.
This consumes the map and returns an (optional_item, map) pair.
Trait Implementations§
source§impl<S: PartialEq> PartialEq for TyghtMap<S>
impl<S: PartialEq> PartialEq for TyghtMap<S>
impl<S: Copy> Copy for TyghtMap<S>
impl<S: Eq> Eq for TyghtMap<S>
impl<S> StructuralPartialEq for TyghtMap<S>
Auto Trait Implementations§
impl<S> RefUnwindSafe for TyghtMap<S>where
S: RefUnwindSafe,
impl<S> Send for TyghtMap<S>where
S: Send,
impl<S> Sync for TyghtMap<S>where
S: Sync,
impl<S> Unpin for TyghtMap<S>where
S: Unpin,
impl<S> UnwindSafe for TyghtMap<S>where
S: UnwindSafe,
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