Struct dfir_rs::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
§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