Struct hydroflow::util::sparse_vec::SparseVec
source · pub struct SparseVec<T> { /* private fields */ }
Expand description
A vector that supports efficient deletion without reordering all subsequent items.
Implementations§
source§impl<T: Clone + Eq + Hash> SparseVec<T>
impl<T: Clone + Eq + Hash> SparseVec<T>
sourcepub fn push(&mut self, item: T)
pub fn push(&mut self, item: T)
Insert item into the vector, see https://doc.rust-lang.org/std/vec/struct.Vec.html#method.push
sourcepub fn delete(&mut self, item: &T)
pub fn delete(&mut self, item: &T)
Delete all items of a specific value from this vector. This takes time proportional to the amount of items with that value in the vector, not the total size of the vector.
sourcepub fn iter(
&self
) -> impl DoubleEndedIterator<Item = &T> + FusedIterator + Clone
pub fn iter( &self ) -> impl DoubleEndedIterator<Item = &T> + FusedIterator + Clone
Iterate through all items in the vector in order. Deleted items will not appear in the iteration.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for SparseVec<T>
impl<T> RefUnwindSafe for SparseVec<T>where
T: RefUnwindSafe,
impl<T> Send for SparseVec<T>where
T: Send,
impl<T> Sync for SparseVec<T>where
T: Sync,
impl<T> Unpin for SparseVec<T>where
T: Unpin,
impl<T> UnwindSafe for SparseVec<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