Skip to content

Commit c33e556

Browse files
committed
order: Add enum Order
1 parent 702de70 commit c33e556

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ pub use crate::dimension::IxDynImpl;
145145
pub use crate::dimension::NdIndex;
146146
pub use crate::error::{ErrorKind, ShapeError};
147147
pub use crate::indexes::{indices, indices_of};
148+
pub use crate::order::Order;
148149
pub use crate::slice::{
149150
MultiSliceArg, NewAxis, Slice, SliceArg, SliceInfo, SliceInfoElem, SliceNextDim,
150151
};
@@ -202,6 +203,7 @@ mod linspace;
202203
mod logspace;
203204
mod math_cell;
204205
mod numeric_util;
206+
mod order;
205207
mod partial;
206208
mod shape_builder;
207209
#[macro_use]

src/order.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
/// Array order description
3+
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
4+
#[non_exhaustive]
5+
pub enum Order {
6+
/// Row major or "C" order
7+
RowMajor,
8+
/// Column major or "F" order
9+
ColumnMajor,
10+
}
11+
12+
impl Order {
13+
/// "C" is an alias for row major ordering
14+
pub const C: Order = Order::RowMajor;
15+
16+
/// "F" (for Fortran) is an alias for column major ordering
17+
pub const F: Order = Order::ColumnMajor;
18+
}

0 commit comments

Comments
 (0)