[][src]Trait rubbl_core::num::DimFromShapeSlice

pub trait DimFromShapeSlice<T>: Sized {
    fn from_shape_slice(shape: &[T]) -> Result<Self, DimensionMismatchError>;
}

Adapt a slice representing an array shape into an ndarray::Dimension type.

In ndarray array dimensionalities are statically typed, but it is often the case that we are reading arrays from data files where the array dimensionality may not match the expectations of the compiled code. This trait makes it possible to convert a runtime-flexible array shape into one of the compile-time types … if the two dimensionalities are in fact the same.

Required methods

fn from_shape_slice(shape: &[T]) -> Result<Self, DimensionMismatchError>

Try to create the implementing type from the specified array shape, specified as a slice.

Returns an Err with an ErrorKind of DimensionMismatch if the slice size does not match the expected dimensionality.

Loading content...

Implementations on Foreign Types

impl DimFromShapeSlice<u64> for Ix0[src]

impl DimFromShapeSlice<usize> for Ix0[src]

impl DimFromShapeSlice<u64> for Ix1[src]

impl DimFromShapeSlice<usize> for Ix1[src]

impl DimFromShapeSlice<u64> for Ix2[src]

impl DimFromShapeSlice<usize> for Ix2[src]

impl DimFromShapeSlice<u64> for Ix3[src]

impl DimFromShapeSlice<usize> for Ix3[src]

impl DimFromShapeSlice<u64> for Ix4[src]

impl DimFromShapeSlice<usize> for Ix4[src]

impl DimFromShapeSlice<u64> for Ix5[src]

impl DimFromShapeSlice<usize> for Ix5[src]

impl DimFromShapeSlice<u64> for Ix6[src]

impl DimFromShapeSlice<usize> for Ix6[src]

Loading content...

Implementors

Loading content...