Struct ndsparse::csl::CslLineConstructor [−][src]
pub struct CslLineConstructor<'a, DS, IS, OS, const D: usize> { /* fields omitted */ }
Expand description
Constructs valid lines in a easy and interactive manner, abstracting away the complexity of the compressed sparse format.
Implementations
Jumps to the next outermost dimension, i.e., from right to left.
Example
use ndsparse::csl::{CslRef, CslVec}; let mut csl = CslVec::<i32, 3>::default(); csl .constructor()? .next_outermost_dim(3)? .push_line([(0, 1)].iter().copied())? .next_outermost_dim(4)? .push_line([(1, 2)].iter().copied())? .push_empty_line()? .push_line([(0, 3), (1,4)].iter().copied())?; assert_eq!( csl.sub_dim(0..4), CslRef::new([4, 3], &[1, 2, 3, 4][..], &[0, 1, 0, 1][..], &[0, 1, 2, 2, 4][..]).ok() );
This is the same as push_line([].iter(), [].iter())
.
Example
use ndsparse::csl::{CslRef, CslVec}; let mut csl = CslVec::<i32, 3>::default(); let constructor = csl.constructor()?.next_outermost_dim(3)?; constructor.push_empty_line()?.next_outermost_dim(2)?.push_empty_line()?; assert_eq!(csl.line([0, 0, 0]), CslRef::new([3], &[][..], &[][..], &[0, 0][..]).ok());
Pushes a new compressed line, modifying the internal structure and if applicable, increases the current dimension length.
The iterator will be truncated to (usize::Max - last offset value + 1) or (last dimension value) and it can lead to a situation where no values will be inserted.
Arguments
data
: Iterator of cloned items.indcs
: Iterator of the respective indices of each item.
Example
use ndsparse::csl::{CslRef, CslVec}; let mut csl = CslVec::<i32, 3>::default(); csl.constructor()?.next_outermost_dim(50)?.push_line([(1, 1), (40, 2)].iter().copied())?; let line = csl.line([0, 0, 0]); assert_eq!(line, CslRef::new([50], &[1, 2][..], &[1, 40][..], &[0, 2][..]).ok());
Trait Implementations
impl<'a, DS: PartialEq, IS: PartialEq, OS: PartialEq, const D: usize> PartialEq<CslLineConstructor<'a, DS, IS, OS, D>> for CslLineConstructor<'a, DS, IS, OS, D>
impl<'a, DS: PartialEq, IS: PartialEq, OS: PartialEq, const D: usize> PartialEq<CslLineConstructor<'a, DS, IS, OS, D>> for CslLineConstructor<'a, DS, IS, OS, D>
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
impl<'a, DS, IS, OS, const D: usize> StructuralPartialEq for CslLineConstructor<'a, DS, IS, OS, D>
Auto Trait Implementations
impl<'a, DS, IS, OS, const D: usize> RefUnwindSafe for CslLineConstructor<'a, DS, IS, OS, D> where
DS: RefUnwindSafe,
IS: RefUnwindSafe,
OS: RefUnwindSafe,
impl<'a, DS, IS, OS, const D: usize> Send for CslLineConstructor<'a, DS, IS, OS, D> where
DS: Send,
IS: Send,
OS: Send,
impl<'a, DS, IS, OS, const D: usize> Sync for CslLineConstructor<'a, DS, IS, OS, D> where
DS: Sync,
IS: Sync,
OS: Sync,
impl<'a, DS, IS, OS, const D: usize> Unpin for CslLineConstructor<'a, DS, IS, OS, D>
impl<'a, DS, IS, OS, const D: usize> !UnwindSafe for CslLineConstructor<'a, DS, IS, OS, D>