Struct matrixable::strategies::ShiftBack
source · pub struct ShiftBack(pub usize);
Expand description
Performs a circular shift of elements from left to right.
§Field
usize
: The number of back-shifts to be performed.
§Example
use matrixable::MatrixExt;
use matrixable::strategies::{ TransformStrategy, ShiftBack };
let m = [
[ 0, 1, 2 ],
[ 3, 4, 5 ],
[ 6, 7, 8 ]
];
// `m` is borrowed
let access = m.access(ShiftBack(2));
let expected = [
[ 2, 3, 4 ],
[ 5, 6, 7 ],
[ 8, 0, 1 ]
];
assert!(expected.iter().eq(access.iter()));
// `m` is consumed.
let t = ShiftBack(2).out_of(m);
assert_eq!(expected, t);
Tuple Fields§
§0: usize
Trait Implementations§
source§impl<M: MatrixExt> AccessStrategy<M> for ShiftBack
impl<M: MatrixExt> AccessStrategy<M> for ShiftBack
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 ShiftBack
impl Ord for ShiftBack
source§impl PartialEq for ShiftBack
impl PartialEq for ShiftBack
source§impl PartialOrd for ShiftBack
impl PartialOrd for ShiftBack
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 ShiftBack
impl<M: MatrixMutExt> TransformStrategy<M> for ShiftBack
impl Copy for ShiftBack
impl Eq for ShiftBack
impl StructuralPartialEq for ShiftBack
Auto Trait Implementations§
impl RefUnwindSafe for ShiftBack
impl Send for ShiftBack
impl Sync for ShiftBack
impl Unpin for ShiftBack
impl UnwindSafe for ShiftBack
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