[][src]Struct mop_blocks::dr_matrix::DrMatrixRowConstructor

pub struct DrMatrixRowConstructor<'a, DS> { /* fields omitted */ }

Constructs a new valid row in a easy and interactive manner.

This struct may panic when out of scope. Please see the Drop documentation in the Trait Implementations section for more information. #[derive(Debug, PartialEq)]

Methods

impl<'a, DS> DrMatrixRowConstructor<'a, DS> where
    DS: Push<Input = <DS as Storage>::Item> + Storage
[src]

pub fn clone_values_from_row<'b>(self, row: &'b [DS::Item]) -> Self where
    DS::Item: Clone + 'b,
    DS: Extend<&'b <DS as Storage>::Item>, 
[src]

Clones all values of row into the current row.

Example

use mop_blocks::{doc_tests::capacited_dr_matrix_vec, dr_matrix::DrMatrixRef};
let mut a = capacited_dr_matrix_vec();
a.row_constructor().copy_values_from_row(&[1, 2, 3, 4, 5]).commit();
assert_eq!(a.as_ref(), DrMatrixRef::new(1, 5, &[1, 2, 3, 4, 5][..]));

pub fn commit(self)[src]

Commits the row construction, modifying the internal structure.

Example

use mop_blocks::{doc_tests::capacited_dr_matrix_vec, dr_matrix::DrMatrixRef};
let mut a = capacited_dr_matrix_vec();
a.row_constructor()
  .push_value(1)
  .push_value(2)
  .push_value(3)
  .push_value(4)
  .push_value(5)
  .commit();
assert_eq!(a.as_ref(), DrMatrixRef::new(1, 5, &[1, 2, 3, 4, 5][..]));

Assertions

  • The number of inserted elements must be equal the number of columns of Self.
use mop_blocks::{doc_tests::capacited_dr_matrix_vec, dr_matrix::DrMatrixRef};
let mut a = capacited_dr_matrix_vec();
a.row_constructor().push_value(1).commit();

pub fn copy_values_from_row<'b>(self, row: &'b [DS::Item]) -> Self where
    DS::Item: Copy + 'b,
    DS: Extend<&'b <DS as Storage>::Item>, 
[src]

Copies all values of row into the current row.

Example

use mop_blocks::{doc_tests::capacited_dr_matrix_vec, dr_matrix::DrMatrixRef};
let mut a = capacited_dr_matrix_vec();
a.row_constructor().copy_values_from_row(&[1, 2, 3, 4, 5]).commit();
assert_eq!(a.as_ref(), DrMatrixRef::new(1, 5, &[1, 2, 3, 4, 5][..]));

pub fn push_value(self, value: DS::Item) -> Self[src]

Pushes a new value.

Example

use mop_blocks::{doc_tests::{capacited_dr_matrix_vec, dr_matrix_array}, dr_matrix::DrMatrixVec};
let mut a = capacited_dr_matrix_vec();
a.row_constructor()
  .push_value(1)
  .push_value(2)
  .push_value(3)
  .push_value(4)
  .push_value(5)
  .commit();
a.row_constructor()
  .push_value(6)
  .push_value(7)
  .push_value(8)
  .push_value(9)
  .push_value(10)
  .commit();
a.row_constructor()
  .push_value(11)
  .push_value(12)
  .push_value(13)
  .push_value(14)
  .push_value(15)
  .commit();
a.row_constructor()
  .push_value(16)
  .push_value(17)
  .push_value(18)
  .push_value(19)
  .push_value(20)
  .commit();
assert_eq!(a.as_ref(), dr_matrix_array().as_ref());

Trait Implementations

impl<'a, DS: Debug> Debug for DrMatrixRowConstructor<'a, DS>[src]

impl<'a, DS> Drop for DrMatrixRowConstructor<'a, DS>[src]

fn drop(&mut self)[src]

Some measures are taken to ensure a valid format and avoid unexpected runtime behavior.

Assertions

  • Every single nonempty instance of DrMatrixRowConstructor must end with a call to the commit method.
use mop_blocks::{doc_tests::capacited_dr_matrix_vec, dr_matrix::DrMatrixVec};
let mut a = capacited_dr_matrix_vec();
a.row_constructor().push_value(1).push_value(2).push_value(3).push_value(4);

impl<'a, DS: PartialEq> PartialEq<DrMatrixRowConstructor<'a, DS>> for DrMatrixRowConstructor<'a, DS>[src]

impl<'a, DS> StructuralPartialEq for DrMatrixRowConstructor<'a, DS>[src]

Auto Trait Implementations

impl<'a, DS> Send for DrMatrixRowConstructor<'a, DS> where
    DS: Send

impl<'a, DS> Sync for DrMatrixRowConstructor<'a, DS> where
    DS: Sync

impl<'a, DS> Unpin for DrMatrixRowConstructor<'a, DS>

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> TraitCfg for 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.