Struct extendr_api::prelude::Axis
source · 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