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§
Provided Methods§
Sourcefn shape_1d(&self) -> usize
fn shape_1d(&self) -> usize
Returns the first dimension shape
Exists to bypass a match on ShapeDim for Array shaped types
Sourcefn shape_2d(&self) -> (usize, usize)
fn shape_2d(&self) -> (usize, usize)
Returns the first and second dimension shapes
Exists to bypass a match on ShapeDim for Table shaped types
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl Shape for Array
impl Shape for ArrayV
impl Shape for Bitmask
impl Shape for BitmaskV
impl Shape for BooleanArray<()>
impl Shape for BooleanArrayV
impl Shape for Cube
impl Shape for FieldArray
impl Shape for Matrix
impl Shape for NumericArray
impl Shape for NumericArrayV
impl Shape for ShapeDim
Implement Shape for ShapeDim so recursive calls like item.shape_3d()
compile when iterating Collection(Vec<ShapeDim>).