#[non_exhaustive]pub enum Order {
RowMajor,
ColumnMajor,
}
Expand description
Array order
Order refers to indexing order, or how a linear sequence is translated into a two-dimensional or multi-dimensional array.
RowMajor
means that the index along the row is the most rapidly changingColumnMajor
means that the index along the column is the most rapidly changing
Given a sequence like: 1, 2, 3, 4, 5, 6
If it is laid it out in a 2 x 3 matrix using row major ordering, it results in:
1 2 3
4 5 6
If it is laid using column major ordering, it results in:
1 3 5
2 4 6
It can be seen as filling in “rows first” or “columns first”.
Order
can be used both to refer to logical ordering as well as memory ordering or memory
layout. The orderings have common short names, also seen in other environments, where
row major is called “C” order (after the C programming language) and column major is called “F”
or “Fortran” order.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Implementations§
Source§impl Order
impl Order
Sourcepub const F: Order = Order::ColumnMajor
pub const F: Order = Order::ColumnMajor
“F” (for Fortran) is an alias for column major ordering
Sourcepub fn is_row_major(self) -> bool
pub fn is_row_major(self) -> bool
Return true if input is Order::RowMajor, false otherwise
Sourcepub fn is_column_major(self) -> bool
pub fn is_column_major(self) -> bool
Return true if input is Order::ColumnMajor, false otherwise
Sourcepub fn row_major(row_major: bool) -> Order
pub fn row_major(row_major: bool) -> Order
Return Order::RowMajor if the input is true, Order::ColumnMajor otherwise
Sourcepub fn column_major(column_major: bool) -> Order
pub fn column_major(column_major: bool) -> Order
Return Order::ColumnMajor if the input is true, Order::RowMajor otherwise
Trait Implementations§
impl Copy for Order
impl Eq for Order
impl StructuralPartialEq for Order
Auto Trait Implementations§
impl Freeze for Order
impl RefUnwindSafe for Order
impl Send for Order
impl Sync for Order
impl Unpin for Order
impl UnwindSafe for Order
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
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)
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> ⓘ
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> ⓘ
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