pub struct DrMatrixRowConstructor<'a, DS> { /* private fields */ }Expand description
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)]
Implementations§
Source§impl<'a, DS> DrMatrixRowConstructor<'a, DS>where
DS: DynDenseStoMut,
impl<'a, DS> DrMatrixRowConstructor<'a, DS>where
DS: DynDenseStoMut,
Sourcepub fn clone_values_from_row(self, row: &[DS::Item]) -> Self
pub fn clone_values_from_row(self, row: &[DS::Item]) -> Self
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],
));Sourcepub fn commit(self)
pub fn commit(self)
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();Sourcepub fn copy_values_from_row(self, row: &[DS::Item]) -> Self
pub fn copy_values_from_row(self, row: &[DS::Item]) -> Self
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],
));Sourcepub fn push_value(self, value: DS::Item) -> Self
pub fn push_value(self, value: DS::Item) -> Self
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§
Source§impl<'a, DS: Debug> Debug for DrMatrixRowConstructor<'a, DS>
impl<'a, DS: Debug> Debug for DrMatrixRowConstructor<'a, DS>
Source§impl<'a, DS> Drop for DrMatrixRowConstructor<'a, DS>
impl<'a, DS> Drop for DrMatrixRowConstructor<'a, DS>
Source§fn drop(&mut self)
fn drop(&mut self)
Some measures are taken to ensure a valid format and avoid unexpected runtime behavior.
§Assertions
- Every single nonempty instance of
DrMatrixRowConstructormust end with a call to thecommitmethod.
ⓘ
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);Source§impl<'a, DS: PartialEq> PartialEq for DrMatrixRowConstructor<'a, DS>
impl<'a, DS: PartialEq> PartialEq for DrMatrixRowConstructor<'a, DS>
Source§fn eq(&self, other: &DrMatrixRowConstructor<'a, DS>) -> bool
fn eq(&self, other: &DrMatrixRowConstructor<'a, DS>) -> bool
Tests for
self and other values to be equal, and is used by ==.impl<'a, DS> StructuralPartialEq for DrMatrixRowConstructor<'a, DS>
Auto Trait Implementations§
impl<'a, DS> Freeze for DrMatrixRowConstructor<'a, DS>
impl<'a, DS> RefUnwindSafe for DrMatrixRowConstructor<'a, DS>where
DS: RefUnwindSafe,
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>
impl<'a, DS> !UnwindSafe for DrMatrixRowConstructor<'a, DS>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more