[−][src]Struct toolbox::ds::matrix::Matrix
Rectangular table of elements (two-dimensional array).
Methods
impl<'a, T> Matrix<'a, T> where
T: Default + Clone,
[src]
T: Default + Clone,
pub fn new(rows: usize, cols: usize) -> Self
[src]
Creates new Matrix.
rows
- rows number.
cols
- columns number.
Panic, if memory allocation is not succesfully.
pub fn clear(&mut self)
[src]
Fills matrix with a default values.
pub fn fill(&mut self, value: T)
[src]
Fills matrix with a value
.
pub fn rows(&self) -> usize
[src]
Returns rows number.
pub fn cols(&self) -> usize
[src]
Returns columns number.
pub fn get(&self, row: usize, col: usize) -> &T
[src]
Returns value at [row][col] position.
There are bounds checking. If index out of range, then panic.
pub fn set(&mut self, row: usize, col: usize, value: T)
[src]
Sets the value
of element at [row][col] position.
There are bounds checking. If index out of range, then panic.
Trait Implementations
impl<'a, T> Drop for Matrix<'a, T> where
T: Default + Clone,
[src]
T: Default + Clone,
impl<'a, T> Index<usize> for Matrix<'a, T> where
T: Default + Clone,
[src]
T: Default + Clone,
type Output = [T]
The returned type after indexing.
fn index(&self, row: usize) -> &Self::Output
[src]
impl<'a, T> IndexMut<usize> for Matrix<'a, T> where
T: Default + Clone,
[src]
T: Default + Clone,
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for Matrix<'a, T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T> Send for Matrix<'a, T> where
T: Send,
T: Send,
impl<'a, T> Sync for Matrix<'a, T> where
T: Sync,
T: Sync,
impl<'a, T> Unpin for Matrix<'a, T>
impl<'a, T> !UnwindSafe for Matrix<'a, T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,