Skip to main content

Shape

Trait Shape 

Source
pub trait Shape {
    // Required method
    fn shape(&self) -> ShapeDim;

    // Provided methods
    fn shape_1d(&self) -> usize { ... }
    fn shape_2d(&self) -> (usize, usize) { ... }
    fn shape_3d(&self) -> (usize, usize, usize) { ... }
    fn shape_4d(&self) -> (usize, usize, usize, usize) { ... }
}
Expand description

Shape trait.

Returns a recursively-describable Shape for the receiver.

Includes accessor types for common use cases e.g., shape_1d, shape_2d, which are automatic provided the implementor implements shape.

Required Methods§

Source

fn shape(&self) -> ShapeDim

Returns arbitrary Shape dimension for any data shape

Provided Methods§

Source

fn shape_1d(&self) -> usize

Returns the first dimension shape

Exists to bypass a match on ShapeDim for Array shaped types

Source

fn shape_2d(&self) -> (usize, usize)

Returns the first and second dimension shapes

Exists to bypass a match on ShapeDim for Table shaped types

Source

fn shape_3d(&self) -> (usize, usize, usize)

Returns the first, second and third dimension shapes

Exists to bypass a match on ShapeDim for 3D types

Source

fn shape_4d(&self) -> (usize, usize, usize, usize)

Returns the first, second, third and fourth dimension shapes

Exists to bypass a match on ShapeDim for 4D types

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Shape for Array

Source§

impl Shape for ArrayV

Source§

impl Shape for Bitmask

Source§

impl Shape for BitmaskV

Source§

impl Shape for BooleanArray<()>

Source§

impl Shape for BooleanArrayV

Source§

impl Shape for FieldArray

Source§

impl Shape for NumericArray

Source§

impl Shape for NumericArrayV

Source§

impl Shape for ShapeDim

Implement Shape for ShapeDim so recursive calls like item.shape_3d() compile when iterating Collection(Vec<ShapeDim>).

Source§

impl Shape for SuperArray

Source§

impl Shape for SuperArrayV

Source§

impl Shape for SuperTable

Source§

impl Shape for SuperTableV

Source§

impl Shape for Table

Source§

impl Shape for TableV

Source§

impl Shape for TextArray

Source§

impl Shape for TextArrayV

Source§

impl<T> Shape for CategoricalArray<T>
where T: Integer,

Source§

impl<T> Shape for FloatArray<T>
where T: Float,

Source§

impl<T> Shape for IntegerArray<T>
where T: Integer,

Source§

impl<T> Shape for StringArray<T>
where T: Integer,