pub struct IndexVec<I: Idx, V> { /* private fields */ }Implementations§
Source§impl<I: Idx, V> IndexVec<I, V>
impl<I: Idx, V> IndexVec<I, V>
pub fn new() -> Self
pub fn with_capacity(cap: usize) -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn push(&mut self, value: V) -> I
pub fn push(&mut self, value: V) -> I
Append a value, returning the assigned ID. Allocation is
monotonic — IDs are stable for the lifetime of this IndexVec.
Sourcepub fn get_mut(&mut self, id: I) -> Option<&mut V>
pub fn get_mut(&mut self, id: I) -> Option<&mut V>
O(1) mutable lookup. Returns None for out-of-range IDs.
Trait Implementations§
Auto Trait Implementations§
impl<I, V> Freeze for IndexVec<I, V>
impl<I, V> RefUnwindSafe for IndexVec<I, V>where
I: RefUnwindSafe,
V: RefUnwindSafe,
impl<I, V> Send for IndexVec<I, V>
impl<I, V> Sync for IndexVec<I, V>
impl<I, V> Unpin for IndexVec<I, V>
impl<I, V> UnsafeUnpin for IndexVec<I, V>
impl<I, V> UnwindSafe for IndexVec<I, V>where
I: UnwindSafe,
V: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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