Trait Shape

Source
pub trait Shape:
    AsRef<[usize]>
    + Clone
    + Debug
    + Eq
    + PartialEq {
    // Required method
    fn strides(&self) -> Self;

    // Provided methods
    fn iter(&self) -> Iter<'_, usize> { ... }
    fn len(&self) -> usize { ... }
    fn is_empty(&self) -> bool { ... }
}
Expand description

A type that can act as a shape for an SFS.

This is simply a trait alias for things like arrays and slices of usize. Users should not need to implement this trait or care about its internals.

Required Methods§

Source

fn strides(&self) -> Self

Returns the strides of the shape.

Provided Methods§

Source

fn iter(&self) -> Iter<'_, usize>

Returns an iterator of the values of the shape.

Source

fn len(&self) -> usize

Returns the length of the shape.

Source

fn is_empty(&self) -> bool

Returns true if the shape is empty, false otherwise.

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 Shape for DynShape

Source§

impl<const D: usize> Shape for ConstShape<D>