pub trait Dimension:
Clone
+ Eq
+ Debug
+ Send
+ Sync
+ Default
+ IndexMut<usize, Output = usize>
+ Add<Self, Output = Self>
+ AddAssign
+ for<'x> AddAssign<&'x Self>
+ Sub<Self, Output = Self>
+ SubAssign
+ for<'x> SubAssign<&'x Self>
+ Mul<usize, Output = Self>
+ Mul<Self, Output = Self>
+ MulAssign
+ for<'x> MulAssign<&'x Self>
+ MulAssign<usize>
+ DimMax<Ix0, Output = Self>
+ DimMax<Self, Output = Self>
+ DimMax<IxDyn, Output = IxDyn>
+ DimMax<Self::Smaller, Output = Self>
+ DimMax<Self::Larger, Output = Self::Larger>
+ DimAdd<Self>
+ DimAdd<Self::Smaller>
+ DimAdd<Self::Larger>
+ DimAdd<Ix0, Output = Self>
+ DimAdd<Ix1, Output = Self::Larger>
+ DimAdd<IxDyn, Output = IxDyn> {
type Pattern: IntoDimension<Dim = Self> + Clone + Debug + PartialEq + Eq + Default;
type Smaller: Dimension;
type Larger: Dimension + RemoveAxis;
const NDIM: Option<usize>;
// Required methods
fn ndim(&self) -> usize;
fn into_pattern(self) -> Self::Pattern;
fn zeros(ndim: usize) -> Self;
// Provided methods
fn size(&self) -> usize { ... }
fn size_checked(&self) -> Option<usize> { ... }
fn as_array_view(&self) -> ArrayView1<'_, Ix> { ... }
fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix> { ... }
fn into_dyn(self) -> IxDyn { ... }
}
Expand description
Array shape and index trait.
This trait defines a number of methods and operations that can be used on dimensions and indices.
Note: This trait can not be implemented outside the crate
Required Associated Constants§
Required Associated Types§
Sourcetype Pattern: IntoDimension<Dim = Self> + Clone + Debug + PartialEq + Eq + Default
type Pattern: IntoDimension<Dim = Self> + Clone + Debug + PartialEq + Eq + Default
Pattern matching friendly form of the dimension value.
- For
Ix1
:usize
, - For
Ix2
:(usize, usize)
- and so on..
- For
IxDyn
:IxDyn
Sourcetype Larger: Dimension + RemoveAxis
type Larger: Dimension + RemoveAxis
Next larger dimension
Required Methods§
Sourcefn into_pattern(self) -> Self::Pattern
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
Provided Methods§
Sourcefn size_checked(&self) -> Option<usize>
fn size_checked(&self) -> Option<usize>
Compute the size while checking for overflow.
Sourcefn as_array_view(&self) -> ArrayView1<'_, Ix>
fn as_array_view(&self) -> ArrayView1<'_, Ix>
Borrow as a read-only array view.
Sourcefn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
Borrow as a read-write array view.
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.