pub trait MatIndex {
type Rows: Copy + Eq + Debug;
type Cols: Copy + Eq + Debug;
type Index: Copy;
type LayoutTransform: Copy;
type Item;
type Dyn: MatIndex<Dyn = Self::Dyn, LayoutTransform = Self::LayoutTransform, Item = Self::Item, Slice = Self::Slice>;
type Slice: for<'a> SliceFamily<'a, Self::Item>;
// Required methods
fn nrows(this: &Self) -> Self::Rows;
fn ncols(this: &Self) -> Self::Cols;
unsafe fn get_slice_unchecked<'a>(
this: &'a mut Self,
idx: Self::Index,
n_elems: usize,
) -> <Self::Slice as SliceFamily<'a, Self::Item>>::Slice;
unsafe fn from_dyn_idx(idx: <Self::Dyn as MatIndex>::Index) -> Self::Index;
unsafe fn get_unchecked(this: &mut Self, index: Self::Index) -> Self::Item;
unsafe fn next_unchecked<'a>(
slice: &mut <Self::Slice as SliceFamily<'a, Self::Item>>::Slice,
) -> Self::Item;
fn is_contiguous(this: &Self) -> bool;
fn preferred_layout(this: &Self) -> Self::LayoutTransform;
fn with_layout(this: Self, layout: Self::LayoutTransform) -> Self::Dyn;
}Expand description
type with a given matrix shape
Required Associated Types§
Sourcetype LayoutTransform: Copy
type LayoutTransform: Copy
layout transformation type
Sourcetype Dyn: MatIndex<Dyn = Self::Dyn, LayoutTransform = Self::LayoutTransform, Item = Self::Item, Slice = Self::Slice>
type Dyn: MatIndex<Dyn = Self::Dyn, LayoutTransform = Self::LayoutTransform, Item = Self::Item, Slice = Self::Slice>
matrix type with type erased dimensions
type Slice: for<'a> SliceFamily<'a, Self::Item>
Required Methods§
Sourceunsafe fn get_slice_unchecked<'a>(
this: &'a mut Self,
idx: Self::Index,
n_elems: usize,
) -> <Self::Slice as SliceFamily<'a, Self::Item>>::Slice
unsafe fn get_slice_unchecked<'a>( this: &'a mut Self, idx: Self::Index, n_elems: usize, ) -> <Self::Slice as SliceFamily<'a, Self::Item>>::Slice
returns slice at index of length n_elems
Sourceunsafe fn from_dyn_idx(idx: <Self::Dyn as MatIndex>::Index) -> Self::Index
unsafe fn from_dyn_idx(idx: <Self::Dyn as MatIndex>::Index) -> Self::Index
converts a type erased index back to its original representation
Sourceunsafe fn get_unchecked(this: &mut Self, index: Self::Index) -> Self::Item
unsafe fn get_unchecked(this: &mut Self, index: Self::Index) -> Self::Item
get the item at the given index, skipping bound checks
Sourceunsafe fn next_unchecked<'a>(
slice: &mut <Self::Slice as SliceFamily<'a, Self::Item>>::Slice,
) -> Self::Item
unsafe fn next_unchecked<'a>( slice: &mut <Self::Slice as SliceFamily<'a, Self::Item>>::Slice, ) -> Self::Item
get the item at the given slice position, skipping bound checks
Sourcefn is_contiguous(this: &Self) -> bool
fn is_contiguous(this: &Self) -> bool
checks if the zip matrices are contiguous
Sourcefn preferred_layout(this: &Self) -> Self::LayoutTransform
fn preferred_layout(this: &Self) -> Self::LayoutTransform
computes the preferred iteration layout of the matrices
Sourcefn with_layout(this: Self, layout: Self::LayoutTransform) -> Self::Dyn
fn with_layout(this: Self, layout: Self::LayoutTransform) -> Self::Dyn
applies the layout transformation to the matrices
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.