pub struct SparseContainer<T: Clone> { /* private fields */ }Expand description
A sparse container stores contiguous vertical slices of data
Implementations§
Source§impl<T: Clone> SparseContainer<T>
impl<T: Clone> SparseContainer<T>
pub fn new() -> SparseContainer<T>
Sourcepub fn all_missing(n: usize) -> SparseContainer<T>
pub fn all_missing(n: usize) -> SparseContainer<T>
create an n-length container will all missing data
pub fn present_iter(&self) -> impl Iterator<Item = &T>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn is_present(&self, ix: usize) -> bool
pub fn is_present(&self, ix: usize) -> bool
Sourcepub fn is_missing(&self, ix: usize) -> bool
pub fn is_missing(&self, ix: usize) -> bool
Sourcepub fn defragment(&mut self) -> usize
pub fn defragment(&mut self) -> usize
Ensure all adjacent data slices are joined. Reduces indirection. Returns the number of slice merge operations performed.
pub fn pop_front(&mut self, n: usize) -> Vec<Option<T>>
Sourcepub fn set_missing(&mut self, ix: usize) -> Option<T>
pub fn set_missing(&mut self, ix: usize) -> Option<T>
Set the datum at index ix as missing and return the entry that we there if it existed.
Sourcepub fn extract(&mut self, ix: usize) -> Option<T>
pub fn extract(&mut self, ix: usize) -> Option<T>
Completely remove the datum at index ix and return it if it exists.
This operation decrements the total number of data by one.
Sourcepub fn break_slices(&mut self, max_slice_len: usize)
pub fn break_slices(&mut self, max_slice_len: usize)
Breaks any slice greater than max_slice_len to be between (max_slice_len + 1) / 2 and max_slice_len. This is designed to help parallelism.
Trait Implementations§
Source§impl<T: Clone> AccumScore<T> for SparseContainer<T>
impl<T: Clone> AccumScore<T> for SparseContainer<T>
Source§impl<T: Clone + Clone> Clone for SparseContainer<T>
impl<T: Clone + Clone> Clone for SparseContainer<T>
Source§fn clone(&self) -> SparseContainer<T>
fn clone(&self) -> SparseContainer<T>
Returns a duplicate 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: Clone + TryFrom<Datum>> Container<T> for SparseContainer<T>
impl<T: Clone + TryFrom<Datum>> Container<T> for SparseContainer<T>
Source§fn present_cloned(&self) -> Vec<T>
fn present_cloned(&self) -> Vec<T>
Get as cloned vector containing only the present data
Source§fn insert_overwrite(&mut self, ix: usize, x: T)
fn insert_overwrite(&mut self, ix: usize, x: T)
Insert or overwrite an entry at ix
Source§fn remove(&mut self, ix: usize) -> Option<T>
fn remove(&mut self, ix: usize) -> Option<T>
Remove and return the entry at ix if it exists. Used to mark a present
datum as missing, not to completely remove a record. Does not decrease
the length.
fn push_datum(&mut self, x: Datum)
fn insert_datum(&mut self, row_ix: usize, x: Datum)
Source§impl<T: Clone> Default for SparseContainer<T>
impl<T: Clone> Default for SparseContainer<T>
Source§fn default() -> SparseContainer<T>
fn default() -> SparseContainer<T>
Returns the “default value” for a type. Read more
Source§impl<'de, T> Deserialize<'de> for SparseContainer<T>
impl<'de, T> Deserialize<'de> for SparseContainer<T>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T: Clone> From<Vec<T>> for SparseContainer<T>
impl<T: Clone> From<Vec<T>> for SparseContainer<T>
Source§fn from(xs: Vec<T>) -> SparseContainer<T>
fn from(xs: Vec<T>) -> SparseContainer<T>
Converts to this type from the input type.
Source§impl<T> Serialize for SparseContainer<T>
impl<T> Serialize for SparseContainer<T>
impl<T: Clone> StructuralPartialEq for SparseContainer<T>
Auto Trait Implementations§
impl<T> Freeze for SparseContainer<T>
impl<T> RefUnwindSafe for SparseContainer<T>where
T: RefUnwindSafe,
impl<T> Send for SparseContainer<T>where
T: Send,
impl<T> Sync for SparseContainer<T>where
T: Sync,
impl<T> Unpin for SparseContainer<T>where
T: Unpin,
impl<T> UnwindSafe for SparseContainer<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