[][src]Struct mop_structs::matrix::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: DynDenseStoMut
[src]

pub fn clone_values_from_row(self, row: &[DS::Item]) -> Self where
    DS::Item: Clone
[src]

Clones all values of row into the current row.

Examples

use mop_structs::{
    doc_tests::dr_matrix_empty_vec_array,
    matrix::dr_matrix::DrMatrixRef
};
let mut a = dr_matrix_empty_vec_array();
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.

Examples

use mop_structs::{
    doc_tests::dr_matrix_empty_vec_array,
    matrix::dr_matrix::DrMatrixRef
};
let mut a = dr_matrix_empty_vec_array();
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_structs::doc_tests::dr_matrix_empty_vec_array;
let mut a = dr_matrix_empty_vec_array();
a.row_constructor().push_value(1).commit();

pub fn copy_values_from_row(self, row: &[DS::Item]) -> Self where
    DS::Item: Copy
[src]

Copies all values of row into the current row.

Examples

use mop_structs::{
    doc_tests::dr_matrix_empty_vec_array,
    matrix::dr_matrix::DrMatrixRef
};
let mut a = dr_matrix_empty_vec_array();
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.

Examples

use mop_structs::{
    doc_tests::{dr_matrix_empty_vec_array, dr_matrix_array},
};
let mut a = dr_matrix_empty_vec_array();
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> 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_structs::doc_tests::dr_matrix_empty_vec_array;
let mut a = dr_matrix_empty_vec_array();
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: Debug> Debug 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

Blanket Implementations

impl<T> From for T[src]

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

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.