pub struct SecondarySlotVec<Tag: ?Sized, Val> { /* private fields */ }
Expand description
A secondary map used to associated data with keys from elements in an existing SlotVec
.
Analogous to slotmap::SecondaryMap
.
Implementations§
Source§impl<Tag: ?Sized, Val> SecondarySlotVec<Tag, Val>
impl<Tag: ?Sized, Val> SecondarySlotVec<Tag, Val>
Sourcepub fn insert(&mut self, key: Key<Tag>, value: Val) -> Option<Val>
pub fn insert(&mut self, key: Key<Tag>, value: Val) -> Option<Val>
Inserts a value into the SecondarySlotVec
and returns the previous value associated with the key.
Sourcepub fn remove(&mut self, key: Key<Tag>) -> Option<Val>
pub fn remove(&mut self, key: Key<Tag>) -> Option<Val>
Removes a value associated with the key from the SecondarySlotVec
and returns it.
Sourcepub fn get(&self, key: Key<Tag>) -> Option<&Val>
pub fn get(&self, key: Key<Tag>) -> Option<&Val>
Returns a reference to the value associated with the key.
Sourcepub fn get_mut(&mut self, key: Key<Tag>) -> Option<&mut Val>
pub fn get_mut(&mut self, key: Key<Tag>) -> Option<&mut Val>
Returns a mutable reference to the value associated with the key.
Sourcepub fn get_or_insert_with(
&mut self,
key: Key<Tag>,
default: impl FnOnce() -> Val,
) -> &mut Val
pub fn get_or_insert_with( &mut self, key: Key<Tag>, default: impl FnOnce() -> Val, ) -> &mut Val
Returns a mutable reference to the value associated with the key, inserting a default value if it doesn’t yet exist.
Sourcepub fn iter(
&self,
) -> impl DoubleEndedIterator<Item = (Key<Tag>, &Val)> + FusedIterator + Clone
pub fn iter( &self, ) -> impl DoubleEndedIterator<Item = (Key<Tag>, &Val)> + FusedIterator + Clone
Iterate the key-value pairs, where the value is a shared reference.
Sourcepub fn iter_mut(
&mut self,
) -> impl DoubleEndedIterator<Item = (Key<Tag>, &mut Val)> + FusedIterator
pub fn iter_mut( &mut self, ) -> impl DoubleEndedIterator<Item = (Key<Tag>, &mut Val)> + FusedIterator
Iterate the key-value pairs, where the value is a exclusive reference.
Sourcepub fn values(
&self,
) -> impl DoubleEndedIterator<Item = &Val> + FusedIterator + Clone
pub fn values( &self, ) -> impl DoubleEndedIterator<Item = &Val> + FusedIterator + Clone
Iterate over the values by shared reference.
Sourcepub fn values_mut(
&mut self,
) -> impl DoubleEndedIterator<Item = &mut Val> + FusedIterator
pub fn values_mut( &mut self, ) -> impl DoubleEndedIterator<Item = &mut Val> + FusedIterator
Iterate over the values by exclusive reference.
Sourcepub fn keys(
&self,
) -> impl '_ + DoubleEndedIterator<Item = Key<Tag>> + FusedIterator + Clone
pub fn keys( &self, ) -> impl '_ + DoubleEndedIterator<Item = Key<Tag>> + FusedIterator + Clone
Iterate over the keys.
Trait Implementations§
Source§impl<Tag: ?Sized, Val> Default for SecondarySlotVec<Tag, Val>
impl<Tag: ?Sized, Val> Default for SecondarySlotVec<Tag, Val>
Auto Trait Implementations§
impl<Tag, Val> Freeze for SecondarySlotVec<Tag, Val>where
Tag: ?Sized,
impl<Tag, Val> RefUnwindSafe for SecondarySlotVec<Tag, Val>
impl<Tag, Val> Send for SecondarySlotVec<Tag, Val>
impl<Tag, Val> Sync for SecondarySlotVec<Tag, Val>
impl<Tag, Val> Unpin for SecondarySlotVec<Tag, Val>
impl<Tag, Val> UnwindSafe for SecondarySlotVec<Tag, Val>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more