Skip to main content

Dimension

Trait Dimension 

Source
pub trait Dimension:
    Clone
    + PartialEq
    + Eq
    + Debug
    + Send
    + Sync
    + 'static {
    const NDIM: Option<usize>;

    // Required methods
    fn as_slice(&self) -> &[usize];
    fn as_slice_mut(&mut self) -> &mut [usize];

    // Provided methods
    fn ndim(&self) -> usize { ... }
    fn size(&self) -> usize { ... }
}
Expand description

Trait for types that describe the dimensionality of an array.

Each dimension type knows its number of axes at the type level (except IxDyn which carries it at runtime).

Required Associated Constants§

Source

const NDIM: Option<usize>

The number of axes, or None for dynamic-rank arrays.

Required Methods§

Source

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

Return the shape as a slice.

Source

fn as_slice_mut(&mut self) -> &mut [usize]

Return the shape as a mutable slice.

Provided Methods§

Source

fn ndim(&self) -> usize

Number of dimensions.

Source

fn size(&self) -> usize

Total number of elements (product of all dimension sizes).

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§