pub struct Matrix<'a> {
pub left_bracket: &'a str,
pub right_bracket: &'a str,
/* private fields */
}
Expand description
A matrix e.g. “[[a, b], [x, y]]”
Individual expressions can be accessed with rows to get a random access iterator of row
slices, or by indexing with a 2d array of indices, e.g. matrix[[0, 0]]
Fields§
§left_bracket: &'a str
The matrix’s left bracket
right_bracket: &'a str
The matrix’s right bracket
Implementations§
Source§impl<'a> Matrix<'a>
impl<'a> Matrix<'a>
Sourcepub fn new<E>(
left_bracket: &'a str,
cells: E,
num_cols: usize,
right_bracket: &'a str,
) -> Self
pub fn new<E>( left_bracket: &'a str, cells: E, num_cols: usize, right_bracket: &'a str, ) -> Self
Create a new matrix
cells
is a slice of expressiongs in row-major top-down order. num_cols
is how many
columns exist in the final matrix.
§Panics
When cells.into().len()
is not divisible by num_cols
.
Sourcepub fn rows(&self) -> MatrixRows<'a, '_> ⓘ
pub fn rows(&self) -> MatrixRows<'a, '_> ⓘ
A top-down iterator over rows as slices
Trait Implementations§
Source§impl<'a, 'b> IntoIterator for &'b Matrix<'a>
Matrix references iterate over rows
impl<'a, 'b> IntoIterator for &'b Matrix<'a>
Matrix references iterate over rows
impl<'a> Eq for Matrix<'a>
impl<'a> StructuralPartialEq for Matrix<'a>
Auto Trait Implementations§
impl<'a> Freeze for Matrix<'a>
impl<'a> RefUnwindSafe for Matrix<'a>
impl<'a> Send for Matrix<'a>
impl<'a> Sync for Matrix<'a>
impl<'a> Unpin for Matrix<'a>
impl<'a> UnwindSafe for Matrix<'a>
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