Struct matrixable::strategies::Reverse
source · pub struct Reverse;
Expand description
Reverses a matrix by performing a symmetry of elements by the center of that matrix.
§Example
use matrixable::MatrixExt;
use matrixable::strategies::{ TransformStrategy, Reverse };
let m = [
[ 0, 1, 2 ],
[ 3, 4, 5 ],
[ 6, 7, 8 ]
];
// `m` is borrowed
let access = m.access(Reverse);
let expected = [
[ 8, 7, 6 ],
[ 5, 4, 3 ],
[ 2, 1, 0 ]
];
assert!(expected.iter().eq(access.iter()));
// `m` is consumed.
let t = Reverse.out_of(m);
assert_eq!(expected, t);
Implementations§
Trait Implementations§
source§impl<M: MatrixExt> AccessStrategy<M> for Reverse
impl<M: MatrixExt> AccessStrategy<M> for Reverse
source§fn access(&self, m: &M, i: usize, j: usize) -> Option<(usize, usize)>
fn access(&self, m: &M, i: usize, j: usize) -> Option<(usize, usize)>
Gives the location (if it exists) of the element in a matrix that
should match the indexes (subscripts) provided according to the access strategy. Read more
source§impl Ord for Reverse
impl Ord for Reverse
source§impl PartialEq for Reverse
impl PartialEq for Reverse
source§impl PartialOrd for Reverse
impl PartialOrd for Reverse
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<M: MatrixMutExt> TransformStrategy<M> for Reverse
impl<M: MatrixMutExt> TransformStrategy<M> for Reverse
impl Copy for Reverse
impl Eq for Reverse
impl StructuralPartialEq for Reverse
Auto Trait Implementations§
impl RefUnwindSafe for Reverse
impl Send for Reverse
impl Sync for Reverse
impl Unpin for Reverse
impl UnwindSafe for Reverse
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