Trait Dim

Source
pub trait Dim:
    Copy
    + Debug
    + Default
    + Hash
    + Ord
    + Send
    + Sync {
    type Merge<D: Dim>: Dim;

    const SIZE: Option<usize>;

    // Required methods
    fn from_size(size: usize) -> Self;
    fn size(self) -> usize;
}
Expand description

Array dimension trait.

Required Associated Constants§

Source

const SIZE: Option<usize>

Dimension size if known statically, or None if dynamic.

Required Associated Types§

Source

type Merge<D: Dim>: Dim

Merge dimensions, where constant size is preferred over dynamic.

Required Methods§

Source

fn from_size(size: usize) -> Self

Creates an array dimension with the given size.

§Panics

Panics if the size is not matching a constant-sized dimension.

Source

fn size(self) -> usize

Returns the number of elements in the dimension.

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 Dim for Dyn

Source§

const SIZE: Option<usize> = None

Source§

type Merge<D: Dim> = D

Source§

impl<const N: usize> Dim for Const<N>