[][src]Struct ndsparse::csl::CslLineConstructor

pub struct CslLineConstructor<'a, DATA, DS, IS, PS, const DIMS: usize> { /* fields omitted */ }

Constructs valid lines in a easy and interactive manner, abstracting away the complexity of the compressed sparse format.

Methods

impl<'a, DATA, DS, IS, PS, const DIMS: usize> CslLineConstructor<'a, DATA, DS, IS, PS, DIMS> where
    DS: AsRef<[DATA]> + Push<Input = DATA>,
    IS: AsRef<[usize]> + Push<Input = usize>,
    PS: AsRef<[usize]> + Push<Input = usize>, 
[src]

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::<_, 3>::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::<i32, 0>::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::<i32, 3>::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]

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::<i32, 3>::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, DATA: Debug, DS: Debug, IS: Debug, PS: Debug, const DIMS: usize> Debug for CslLineConstructor<'a, DATA, DS, IS, PS, DIMS>[src]

impl<'a, DATA: PartialEq, DS: PartialEq, IS: PartialEq, PS: PartialEq, const DIMS: usize> PartialEq<CslLineConstructor<'a, DATA, DS, IS, PS, DIMS>> for CslLineConstructor<'a, DATA, DS, IS, PS, DIMS>[src]

impl<'a, DATA, DS, IS, PS, const DIMS: usize> StructuralPartialEq for CslLineConstructor<'a, DATA, DS, IS, PS, DIMS>[src]

Auto Trait Implementations

impl<'a, const DIMS: usize, DATA, DS, IS, PS> RefUnwindSafe for CslLineConstructor<'a, DATA, DS, IS, PS, DIMS> where
    DATA: RefUnwindSafe,
    DS: RefUnwindSafe,
    IS: RefUnwindSafe,
    PS: RefUnwindSafe

impl<'a, const DIMS: usize, DATA, DS, IS, PS> Send for CslLineConstructor<'a, DATA, DS, IS, PS, DIMS> where
    DATA: Send,
    DS: Send,
    IS: Send,
    PS: Send

impl<'a, const DIMS: usize, DATA, DS, IS, PS> Sync for CslLineConstructor<'a, DATA, DS, IS, PS, DIMS> where
    DATA: Sync,
    DS: Sync,
    IS: Sync,
    PS: Sync

impl<'a, const DIMS: usize, DATA, DS, IS, PS> Unpin for CslLineConstructor<'a, DATA, DS, IS, PS, DIMS>

impl<'a, const DIMS: usize, DATA, DS, IS, PS> !UnwindSafe for CslLineConstructor<'a, DATA, DS, IS, PS, DIMS>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,