#[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
RowMajor
Row major or “C” order
ColumnMajor
Column major or “F” order
Implementations
sourceimpl Order
impl Order
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 StructuralEq for Order
impl StructuralPartialEq for Order
Auto Trait Implementations
impl RefUnwindSafe for Order
impl Send for Order
impl Sync for Order
impl Unpin for Order
impl UnwindSafe for Order
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