Skip to main content

INLINE_RANK

Constant INLINE_RANK 

Source
pub const INLINE_RANK: usize = 8 /* 8usize */;
Expand description

Maximum rank whose metadata is stored inline without a heap allocation.

StridedView, StridedViewMut and StridedArray keep up to this many dimensions and strides inline in a fixed-size Copy buffer. Derived views, clones and array constructors are allocation-free at ranks 1 through INLINE_RANK; a higher rank spills to the heap gracefully (never an error).

ยงExamples

use strided_view::{StridedView, INLINE_RANK};

assert_eq!(INLINE_RANK, 8);
let data = [0.0f64; 8];
let view = StridedView::<f64>::new(&data, &[2, 2, 2], &[1, 2, 4], 0).unwrap();
assert_eq!(view.ndim(), 3);