Struct matrixable::strategies::ShiftFront
source · pub struct ShiftFront(pub usize);
Expand description
Performs a circular shift of elements of a matrix from right to left.
§Field
usize
: The number of front-shifts to be performed.
§Example
use matrixable::MatrixExt;
use matrixable::strategies::{ TransformStrategy, ShiftFront };
let m = [
[ 0, 1, 2 ],
[ 3, 4, 5 ],
[ 6, 7, 8 ]
];
// `m` is borrowed
let access = m.access(ShiftFront(2));
let expected = [
[ 7, 8, 0 ],
[ 1, 2, 3 ],
[ 4, 5, 6 ]
];
assert!(expected.iter().eq(access.iter()));
// `m` is consumed.
let t = ShiftFront(2).out_of(m);
assert_eq!(expected, t);
Tuple Fields§
§0: usize
Trait Implementations§
source§impl<M: MatrixExt> AccessStrategy<M> for ShiftFront
impl<M: MatrixExt> AccessStrategy<M> for ShiftFront
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 Clone for ShiftFront
impl Clone for ShiftFront
source§fn clone(&self) -> ShiftFront
fn clone(&self) -> ShiftFront
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ShiftFront
impl Debug for ShiftFront
source§impl Default for ShiftFront
impl Default for ShiftFront
source§fn default() -> ShiftFront
fn default() -> ShiftFront
Returns the “default value” for a type. Read more
source§impl Hash for ShiftFront
impl Hash for ShiftFront
source§impl<M: MatrixMutExt> InPlace<M> for ShiftFront
impl<M: MatrixMutExt> InPlace<M> for ShiftFront
source§impl Ord for ShiftFront
impl Ord for ShiftFront
source§fn cmp(&self, other: &ShiftFront) -> Ordering
fn cmp(&self, other: &ShiftFront) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for ShiftFront
impl PartialEq for ShiftFront
source§fn eq(&self, other: &ShiftFront) -> bool
fn eq(&self, other: &ShiftFront) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for ShiftFront
impl PartialOrd for ShiftFront
source§fn partial_cmp(&self, other: &ShiftFront) -> Option<Ordering>
fn partial_cmp(&self, other: &ShiftFront) -> Option<Ordering>
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 ShiftFront
impl<M: MatrixMutExt> TransformStrategy<M> for ShiftFront
impl Copy for ShiftFront
impl Eq for ShiftFront
impl StructuralPartialEq for ShiftFront
Auto Trait Implementations§
impl RefUnwindSafe for ShiftFront
impl Send for ShiftFront
impl Sync for ShiftFront
impl Unpin for ShiftFront
impl UnwindSafe for ShiftFront
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