[−][src]Struct ndsparse::csl::CslLineConstructor
Constructs valid lines in a easy and interactive manner, abstracting away the complexity of the compressed sparse format.
Methods
impl<'a, DA, DATA, DS, IS, PS> CslLineConstructor<'a, DA, DS, IS, PS> where
DA: Dims,
DS: AsRef<[DATA]> + Push<Input = DATA> + Storage<Item = DATA>,
IS: AsRef<[usize]> + Push<Input = usize>,
PS: AsRef<[usize]> + Push<Input = usize>,
[src]
DA: Dims,
DS: AsRef<[DATA]> + Push<Input = DATA> + Storage<Item = DATA>,
IS: AsRef<[usize]> + Push<Input = usize>,
PS: AsRef<[usize]> + Push<Input = usize>,
pub fn next_outermost_dim(self, len: usize) -> Self
[src]
Jumps to the next outermost dimension, i.e., from right to left.
Example
use ndsparse::csl::{CslRef, CslVec}; let mut csl = CslVec::<[usize; 3], i32>::default(); csl .constructor() .next_outermost_dim(3) .push_line(&[1], &[0]) .next_outermost_dim(4) .push_line(&[2], &[1]) .push_empty_line() .push_line(&[3, 4], &[0, 1]); assert_eq!( csl.sub_dim(0..4), CslRef::new([4, 3], &[1, 2, 3, 4][..], &[0, 1, 0, 1][..], &[0, 1, 2, 2, 4][..]) );
Assertions
- The next dimension must not exceed the defined number of dimensions.
use ndsparse::csl::CslVec; let _ = CslVec::<[usize; 0], i32>::default().constructor().next_outermost_dim(2);
pub fn push_empty_line(self) -> Self
[src]
This is the same as push_line(&[], &[])
.
Example
use ndsparse::csl::{CslRef, CslVec}; let mut csl = CslVec::<[usize; 3], i32>::default(); let constructor = csl.constructor(); constructor.next_outermost_dim(3).push_empty_line().next_outermost_dim(2).push_empty_line(); assert_eq!(csl.line([0, 0, 0]), Some(CslRef::new([3], &[][..], &[][..], &[0, 0][..])));
pub fn push_line(self, data: &[DATA], indcs: &[usize]) -> Self where
DATA: Clone,
[src]
DATA: Clone,
Pushes a new compressed line, modifying the internal structure and if applicable, increasing the current dimension length.
Both data
and indcs
will be truncated by the length of the lesser slice.
Arguments
data
: A slice of cloned items.indcs
: The respective index of each item.
Example
use ndsparse::csl::{CslRef, CslVec}; let mut csl = CslVec::<[usize; 3], i32>::default(); csl.constructor().next_outermost_dim(50).push_line(&[1, 2], &[1, 40]); let line = csl.line([0, 0, 0]); assert_eq!(line, Some(CslRef::new([50], &[1, 2][..], &[1, 40][..], &[0, 2][..])));
Assertions
Uses a subset of the assertions of the Csl::new
method.
Trait Implementations
impl<'a, DA: Debug, DS: Debug, IS: Debug, PS: Debug> Debug for CslLineConstructor<'a, DA, DS, IS, PS> where
DA: Dims,
[src]
DA: Dims,
impl<'a, DA: PartialEq, DS: PartialEq, IS: PartialEq, PS: PartialEq> PartialEq<CslLineConstructor<'a, DA, DS, IS, PS>> for CslLineConstructor<'a, DA, DS, IS, PS> where
DA: Dims,
[src]
DA: Dims,
fn eq(&self, other: &CslLineConstructor<'a, DA, DS, IS, PS>) -> bool
[src]
fn ne(&self, other: &CslLineConstructor<'a, DA, DS, IS, PS>) -> bool
[src]
impl<'a, DA, DS, IS, PS> StructuralPartialEq for CslLineConstructor<'a, DA, DS, IS, PS> where
DA: Dims,
[src]
DA: Dims,
Auto Trait Implementations
impl<'a, DA, DS, IS, PS> RefUnwindSafe for CslLineConstructor<'a, DA, DS, IS, PS> where
DA: RefUnwindSafe,
DS: RefUnwindSafe,
IS: RefUnwindSafe,
PS: RefUnwindSafe,
DA: RefUnwindSafe,
DS: RefUnwindSafe,
IS: RefUnwindSafe,
PS: RefUnwindSafe,
impl<'a, DA, DS, IS, PS> Send for CslLineConstructor<'a, DA, DS, IS, PS> where
DA: Send,
DS: Send,
IS: Send,
PS: Send,
DA: Send,
DS: Send,
IS: Send,
PS: Send,
impl<'a, DA, DS, IS, PS> Sync for CslLineConstructor<'a, DA, DS, IS, PS> where
DA: Sync,
DS: Sync,
IS: Sync,
PS: Sync,
DA: Sync,
DS: Sync,
IS: Sync,
PS: Sync,
impl<'a, DA, DS, IS, PS> Unpin for CslLineConstructor<'a, DA, DS, IS, PS>
impl<'a, DA, DS, IS, PS> !UnwindSafe for CslLineConstructor<'a, DA, DS, IS, PS>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,