Trait mdarray::Dim

source ·
pub trait Dim:
    Copy
    + Debug
    + Default
    + Send
    + Sync {
    type Merge<D: Dim>: Dim;
    type FromExpr<T, S: Shape>: FromExpression<T, S::Prepend<Self>>;

    const SIZE: Option<usize>;

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

Array dimension trait.

Required Associated Types§

source

type Merge<D: Dim>: Dim

Merge dimensions, where constant size is preferred over dynamic.

source

type FromExpr<T, S: Shape>: FromExpression<T, S::Prepend<Self>>

The resulting type after conversion from an expression.

Required Associated Constants§

source

const SIZE: Option<usize>

Dimension size if known statically, or None if 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.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Dim for Dyn

§

type Merge<D: Dim> = D

§

type FromExpr<T, S: Shape> = Grid<T, <S as Shape>::Prepend<Dyn>>

source§

const SIZE: Option<usize> = None

source§

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

§

type Merge<D: Dim> = Const<N>

§

type FromExpr<T, S: Shape> = <<S as Shape>::FromExpr<T> as FromExpression<T, S>>::WithConst<N>

source§

const SIZE: Option<usize> = _