pub struct SlotVec<Tag: ?Sized, Val> { /* private fields */ }
Expand description
A Vec-based SlotMap-esque datastructure without removes.
Implementations§
source§impl<Tag: ?Sized, Val> SlotVec<Tag, Val>
impl<Tag: ?Sized, Val> SlotVec<Tag, Val>
sourcepub fn insert(&mut self, value: Val) -> Key<Tag>
pub fn insert(&mut self, value: Val) -> Key<Tag>
Inserts a value into the SlotVec and returns the key.
sourcepub fn insert_with_key<F>(&mut self, func: F) -> Key<Tag>
pub fn insert_with_key<F>(&mut self, func: F) -> Key<Tag>
Use the provided function to generate a value given the key and insert it into the SlotVec.
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.
Trait Implementations§
Auto Trait Implementations§
impl<Tag, Val> Freeze for SlotVec<Tag, Val>where
Tag: ?Sized,
impl<Tag, Val> RefUnwindSafe for SlotVec<Tag, Val>
impl<Tag, Val> Send for SlotVec<Tag, Val>
impl<Tag, Val> Sync for SlotVec<Tag, Val>
impl<Tag, Val> Unpin for SlotVec<Tag, Val>
impl<Tag, Val> UnwindSafe for SlotVec<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
Mutably borrows from an owned value. Read more
§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>
Converts
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>
Converts
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