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 PartialOrd for Axis
impl PartialOrd for Axis
impl Copy for Axis
impl Eq for Axis
impl StructuralPartialEq for Axis
Auto Trait Implementations§
impl Freeze for Axis
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more