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
sourceimpl Ord for Axis
impl Ord for Axis
sourceimpl PartialOrd<Axis> for Axis
impl PartialOrd<Axis> for Axis
sourcefn partial_cmp(&self, other: &Axis) -> Option<Ordering>
fn partial_cmp(&self, other: &Axis) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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 more
impl 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more