pub struct SparseIndex<T> { /* private fields */ }
Expand description
An index mapping positive integer IDs to optional values.
Implementations§
Source§impl<T> SparseIndex<T>
impl<T> SparseIndex<T>
pub fn new() -> Self
pub fn with_capacity(capacity: usize) -> Self
pub fn entry(&mut self, id: usize) -> Entry<'_, T>
pub fn get(&self, id: usize) -> Option<&T>
pub fn get_mut(&mut self, id: usize) -> Option<&mut T>
pub fn set(&mut self, id: usize, val: T)
pub fn contains_key(&self, id: usize) -> bool
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn iter(&self) -> impl DoubleEndedIterator<Item = (usize, &T)>
pub fn iter_mut(&mut self) -> impl DoubleEndedIterator<Item = (usize, &mut T)>
pub fn keys(&self) -> impl DoubleEndedIterator<Item = usize> + '_
pub fn values(&self) -> impl DoubleEndedIterator<Item = &T>
pub fn values_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut T>
Trait Implementations§
Source§impl<T: Clone> Clone for SparseIndex<T>
impl<T: Clone> Clone for SparseIndex<T>
Source§fn clone(&self) -> SparseIndex<T>
fn clone(&self) -> SparseIndex<T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T: Debug> Debug for SparseIndex<T>
impl<T: Debug> Debug for SparseIndex<T>
Source§impl<T> Default for SparseIndex<T>
impl<T> Default for SparseIndex<T>
Source§impl<T> FromIterator<(usize, T)> for SparseIndex<T>
impl<T> FromIterator<(usize, T)> for SparseIndex<T>
Source§impl<T> Index<usize> for SparseIndex<T>
impl<T> Index<usize> for SparseIndex<T>
Source§impl<T> IndexMut<usize> for SparseIndex<T>
impl<T> IndexMut<usize> for SparseIndex<T>
Auto Trait Implementations§
impl<T> Freeze for SparseIndex<T>
impl<T> RefUnwindSafe for SparseIndex<T>where
T: RefUnwindSafe,
impl<T> Send for SparseIndex<T>where
T: Send,
impl<T> Sync for SparseIndex<T>where
T: Sync,
impl<T> Unpin for SparseIndex<T>where
T: Unpin,
impl<T> UnwindSafe for SparseIndex<T>where
T: 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