pub trait Shape {
type VectorType: IndexMut<usize, Output = usize>;
type DummyVectorType: IndexMut<usize, Output = DummyIndex>;
const DIMENSION: usize;
// Required methods
fn zero(&self) -> Self::VectorType;
fn len(&self) -> usize;
fn shape(&self) -> &[usize];
fn offset(&self) -> &[usize];
// Provided methods
fn dimension(&self) -> usize { ... }
fn dimension_of(_: &Self::VectorType) -> usize { ... }
fn len_of_dimension(
&self,
dimension: usize,
) -> Result<usize, DimensionMismatchingError> { ... }
fn offset_of_dimension(
&self,
dimension: usize,
) -> Result<usize, DimensionMismatchingError> { ... }
fn index(
&self,
vector: &Self::VectorType,
) -> Result<usize, IndexCalculationError> { ... }
fn vector(&self, index: usize) -> Self::VectorType { ... }
fn next_vector(&self, vector: &mut Self::VectorType) -> bool { ... }
fn actual_index(&self, dimension: usize, index: isize) -> Option<usize> { ... }
}
Required Associated Constants§
Required Associated Types§
type VectorType: IndexMut<usize, Output = usize>
type DummyVectorType: IndexMut<usize, Output = DummyIndex>
Required Methods§
fn zero(&self) -> Self::VectorType
fn len(&self) -> usize
fn shape(&self) -> &[usize]
fn offset(&self) -> &[usize]
Provided Methods§
fn dimension(&self) -> usize
fn dimension_of(_: &Self::VectorType) -> usize
fn len_of_dimension( &self, dimension: usize, ) -> Result<usize, DimensionMismatchingError>
fn offset_of_dimension( &self, dimension: usize, ) -> Result<usize, DimensionMismatchingError>
fn index( &self, vector: &Self::VectorType, ) -> Result<usize, IndexCalculationError>
fn vector(&self, index: usize) -> Self::VectorType
fn next_vector(&self, vector: &mut Self::VectorType) -> bool
fn actual_index(&self, dimension: usize, index: isize) -> Option<usize>
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.