pub trait Mapping:
Clone
+ Debug
+ Default
+ Eq
+ Hash
+ Send
+ Sync {
type Shape: Shape;
type Layout: Layout<Mapping<Self::Shape> = Self>;
// Required methods
fn is_contiguous(&self) -> bool;
fn shape(&self) -> &Self::Shape;
fn stride(&self, index: usize) -> isize;
// Provided methods
fn dim(&self, index: usize) -> usize { ... }
fn dims(&self) -> &[usize]
where Self: Mapping<Shape = DynRank> { ... }
fn is_empty(&self) -> bool { ... }
fn len(&self) -> usize { ... }
fn rank(&self) -> usize { ... }
}
Expand description
Array layout mapping trait, including shape and strides.
Required Associated Types§
Required Methods§
Sourcefn is_contiguous(&self) -> bool
fn is_contiguous(&self) -> bool
Returns true
if the array strides are consistent with contiguous memory layout.
Provided Methods§
Sourcefn dim(&self, index: usize) -> usize
fn dim(&self, index: usize) -> usize
Returns the number of elements in the specified dimension.
§Panics
Panics if the dimension is out of bounds.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.