pub struct Axis(pub usize);
Expand description
An axis index.
An axis one of an array’s “dimensions”; an n-dimensional array has n axes. Axis 0 is the array’s outermost axis and n-1 is the innermost.
All array axis arguments use this type to make the code easier to write correctly and easier to understand.
For example: in a method like index_axis(axis, index)
the code becomes
self-explanatory when it’s called like .index_axis(Axis(1), i)
; it’s
evident which integer is the axis number and which is the index.
Note: This type does not implement From/Into usize and similar trait based conversions, because we want to preserve code readability and quality.
Axis(1)
in itself is a very clear code style and the style that should be
avoided is code like 1.into()
.
Tuple Fields§
§0: usize
Implementations§
Trait Implementations§
source§impl Ord for Axis
impl Ord for Axis
source§impl PartialEq<Axis> for Axis
impl PartialEq<Axis> for Axis
source§impl PartialOrd<Axis> for Axis
impl PartialOrd<Axis> for Axis
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 moreimpl Copy for Axis
impl Eq for Axis
impl StructuralEq for Axis
impl StructuralPartialEq for Axis
Auto Trait Implementations§
impl RefUnwindSafe for Axis
impl Send for Axis
impl Sync for Axis
impl Unpin for Axis
impl UnwindSafe for Axis
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