Trait Shape

Source
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§

Required Methods§

Source

fn zero(&self) -> Self::VectorType

Source

fn len(&self) -> usize

Source

fn shape(&self) -> &[usize]

Source

fn offset(&self) -> &[usize]

Provided Methods§

Source

fn dimension(&self) -> usize

Source

fn dimension_of(_: &Self::VectorType) -> usize

Source

fn len_of_dimension( &self, dimension: usize, ) -> Result<usize, DimensionMismatchingError>

Source

fn offset_of_dimension( &self, dimension: usize, ) -> Result<usize, DimensionMismatchingError>

Source

fn index( &self, vector: &Self::VectorType, ) -> Result<usize, IndexCalculationError>

Source

fn vector(&self, index: usize) -> Self::VectorType

Source

fn next_vector(&self, vector: &mut Self::VectorType) -> bool

Source

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.

Implementors§

Source§

impl Shape for DynShape

Source§

impl Shape for Shape1

Source§

impl Shape for Shape2

Source§

impl Shape for Shape3

Source§

impl Shape for Shape4

Source§

impl Shape for Shape5

Source§

impl Shape for Shape6

Source§

impl Shape for Shape7

Source§

impl Shape for Shape8

Source§

impl Shape for Shape9

Source§

impl Shape for Shape10

Source§

impl Shape for Shape11

Source§

impl Shape for Shape12

Source§

impl Shape for Shape13

Source§

impl Shape for Shape14

Source§

impl Shape for Shape15

Source§

impl Shape for Shape16

Source§

impl Shape for Shape17

Source§

impl Shape for Shape18

Source§

impl Shape for Shape19

Source§

impl Shape for Shape20