Skip to content

Commit 4e4d674

Browse files
committed
order: Add enum Order
1 parent 53d1ce2 commit 4e4d674

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
/// Try to preserve the input order
11+
Automatic,
12+
}
13+
14+
impl Order {
15+
/// "C" is an alias for row major ordering
16+
pub const C: Order = Order::RowMajor;
17+
18+
/// "F" (for Fortran) is an alias for column major ordering
19+
pub const F: Order = Order::ColumnMajor;
20+
21+
/// "A" is an alias for automatic ordering
22+
pub const A: Order = Order::Automatic;
23+
}

0 commit comments

Comments
 (0)