pub struct Dim<const NDIM: usize>(/* private fields */);Expand description
A statically-dimensioned shape with exactly NDIM axes, known at compile time.
Dim<N> is the preferred dimension type when the number of axes is determined by the code
structure rather than runtime data. Passing typed arguments to shape-manipulating operations
(e.g. [u64; 2] to reshape, usize to insert_axis) causes the compiler to select
Dim<N> automatically, so callers rarely need to name this type explicitly.
§Neighbors
Dim<N>::Smaller = Dim<N-1> (for N >= 1; Dim<0>::Smaller = DimDyn).
Dim<N>::Larger = Dim<N+1> (for N <= 7; Dim<8>::Larger = DimDyn).
This means that N consecutive insert_axis(0) calls on a Dim<M> array produce a
Dim<M+N> result, as long as M + N <= 8.
Implementations§
Trait Implementations§
Source§impl Dimension for Dim<0>
impl Dimension for Dim<0>
Source§type Vec<T> = [T; 0]
type Vec<T> = [T; 0]
A vec-like container that can hold one value per axis for this dimension type.
Source§fn as_mut_slice(&mut self) -> &mut [u64]
fn as_mut_slice(&mut self) -> &mut [u64]
Return the shape as a mutable slice, with one element per dimension.
Source§fn vec<T>(ndim: usize, f: impl FnMut(usize) -> T) -> Self::Vec<T>
fn vec<T>(ndim: usize, f: impl FnMut(usize) -> T) -> Self::Vec<T>
Build a vec-like container with one value per axis, by applying
f to each axis index.Source§impl Dimension for Dim<1>
impl Dimension for Dim<1>
Source§type Smaller = Dim<{ $dim - 1 }>
type Smaller = Dim<{ $dim - 1 }>
The dimension type that results from removing one axis. Read more
Source§type Larger = Dim<{ $dim + 1 }>
type Larger = Dim<{ $dim + 1 }>
The dimension type that results from adding one axis. Read more
Source§type Vec<T> = [T; 1]
type Vec<T> = [T; 1]
A vec-like container that can hold one value per axis for this dimension type.
Source§fn as_mut_slice(&mut self) -> &mut [u64]
fn as_mut_slice(&mut self) -> &mut [u64]
Return the shape as a mutable slice, with one element per dimension.
Source§fn vec<T>(ndim: usize, f: impl FnMut(usize) -> T) -> Self::Vec<T>
fn vec<T>(ndim: usize, f: impl FnMut(usize) -> T) -> Self::Vec<T>
Build a vec-like container with one value per axis, by applying
f to each axis index.Source§impl Dimension for Dim<2>
impl Dimension for Dim<2>
Source§type Smaller = Dim<{ $dim - 1 }>
type Smaller = Dim<{ $dim - 1 }>
The dimension type that results from removing one axis. Read more
Source§type Larger = Dim<{ $dim + 1 }>
type Larger = Dim<{ $dim + 1 }>
The dimension type that results from adding one axis. Read more
Source§type Vec<T> = [T; 2]
type Vec<T> = [T; 2]
A vec-like container that can hold one value per axis for this dimension type.
Source§fn as_mut_slice(&mut self) -> &mut [u64]
fn as_mut_slice(&mut self) -> &mut [u64]
Return the shape as a mutable slice, with one element per dimension.
Source§fn vec<T>(ndim: usize, f: impl FnMut(usize) -> T) -> Self::Vec<T>
fn vec<T>(ndim: usize, f: impl FnMut(usize) -> T) -> Self::Vec<T>
Build a vec-like container with one value per axis, by applying
f to each axis index.Source§impl Dimension for Dim<3>
impl Dimension for Dim<3>
Source§type Smaller = Dim<{ $dim - 1 }>
type Smaller = Dim<{ $dim - 1 }>
The dimension type that results from removing one axis. Read more
Source§type Larger = Dim<{ $dim + 1 }>
type Larger = Dim<{ $dim + 1 }>
The dimension type that results from adding one axis. Read more
Source§type Vec<T> = [T; 3]
type Vec<T> = [T; 3]
A vec-like container that can hold one value per axis for this dimension type.
Source§fn as_mut_slice(&mut self) -> &mut [u64]
fn as_mut_slice(&mut self) -> &mut [u64]
Return the shape as a mutable slice, with one element per dimension.
Source§fn vec<T>(ndim: usize, f: impl FnMut(usize) -> T) -> Self::Vec<T>
fn vec<T>(ndim: usize, f: impl FnMut(usize) -> T) -> Self::Vec<T>
Build a vec-like container with one value per axis, by applying
f to each axis index.Source§impl Dimension for Dim<4>
impl Dimension for Dim<4>
Source§type Smaller = Dim<{ $dim - 1 }>
type Smaller = Dim<{ $dim - 1 }>
The dimension type that results from removing one axis. Read more
Source§type Larger = Dim<{ $dim + 1 }>
type Larger = Dim<{ $dim + 1 }>
The dimension type that results from adding one axis. Read more
Source§type Index<'a> = (u64, u64, u64, u64)
type Index<'a> = (u64, u64, u64, u64)
The type of the index pattern for this dimension. Read more
Source§type Vec<T> = [T; 4]
type Vec<T> = [T; 4]
A vec-like container that can hold one value per axis for this dimension type.
Source§fn as_mut_slice(&mut self) -> &mut [u64]
fn as_mut_slice(&mut self) -> &mut [u64]
Return the shape as a mutable slice, with one element per dimension.
Source§fn vec<T>(ndim: usize, f: impl FnMut(usize) -> T) -> Self::Vec<T>
fn vec<T>(ndim: usize, f: impl FnMut(usize) -> T) -> Self::Vec<T>
Build a vec-like container with one value per axis, by applying
f to each axis index.Source§impl Dimension for Dim<5>
impl Dimension for Dim<5>
Source§type Smaller = Dim<{ $dim - 1 }>
type Smaller = Dim<{ $dim - 1 }>
The dimension type that results from removing one axis. Read more
Source§type Larger = Dim<{ $dim + 1 }>
type Larger = Dim<{ $dim + 1 }>
The dimension type that results from adding one axis. Read more
Source§type Index<'a> = (u64, u64, u64, u64, u64)
type Index<'a> = (u64, u64, u64, u64, u64)
The type of the index pattern for this dimension. Read more
Source§type Vec<T> = [T; 5]
type Vec<T> = [T; 5]
A vec-like container that can hold one value per axis for this dimension type.
Source§fn as_mut_slice(&mut self) -> &mut [u64]
fn as_mut_slice(&mut self) -> &mut [u64]
Return the shape as a mutable slice, with one element per dimension.
Source§fn vec<T>(ndim: usize, f: impl FnMut(usize) -> T) -> Self::Vec<T>
fn vec<T>(ndim: usize, f: impl FnMut(usize) -> T) -> Self::Vec<T>
Build a vec-like container with one value per axis, by applying
f to each axis index.Source§impl Dimension for Dim<6>
impl Dimension for Dim<6>
Source§type Smaller = Dim<{ $dim - 1 }>
type Smaller = Dim<{ $dim - 1 }>
The dimension type that results from removing one axis. Read more
Source§type Larger = Dim<{ $dim + 1 }>
type Larger = Dim<{ $dim + 1 }>
The dimension type that results from adding one axis. Read more
Source§type Index<'a> = (u64, u64, u64, u64, u64, u64)
type Index<'a> = (u64, u64, u64, u64, u64, u64)
The type of the index pattern for this dimension. Read more
Source§type Vec<T> = [T; 6]
type Vec<T> = [T; 6]
A vec-like container that can hold one value per axis for this dimension type.
Source§fn as_mut_slice(&mut self) -> &mut [u64]
fn as_mut_slice(&mut self) -> &mut [u64]
Return the shape as a mutable slice, with one element per dimension.
Source§fn vec<T>(ndim: usize, f: impl FnMut(usize) -> T) -> Self::Vec<T>
fn vec<T>(ndim: usize, f: impl FnMut(usize) -> T) -> Self::Vec<T>
Build a vec-like container with one value per axis, by applying
f to each axis index.Source§impl Dimension for Dim<7>
impl Dimension for Dim<7>
Source§type Smaller = Dim<{ $dim - 1 }>
type Smaller = Dim<{ $dim - 1 }>
The dimension type that results from removing one axis. Read more
Source§type Larger = Dim<{ $dim + 1 }>
type Larger = Dim<{ $dim + 1 }>
The dimension type that results from adding one axis. Read more
Source§type Index<'a> = (u64, u64, u64, u64, u64, u64, u64)
type Index<'a> = (u64, u64, u64, u64, u64, u64, u64)
The type of the index pattern for this dimension. Read more
Source§type Vec<T> = [T; 7]
type Vec<T> = [T; 7]
A vec-like container that can hold one value per axis for this dimension type.
Source§fn as_mut_slice(&mut self) -> &mut [u64]
fn as_mut_slice(&mut self) -> &mut [u64]
Return the shape as a mutable slice, with one element per dimension.
Source§fn vec<T>(ndim: usize, f: impl FnMut(usize) -> T) -> Self::Vec<T>
fn vec<T>(ndim: usize, f: impl FnMut(usize) -> T) -> Self::Vec<T>
Build a vec-like container with one value per axis, by applying
f to each axis index.Source§impl Dimension for Dim<8>
impl Dimension for Dim<8>
Source§type Index<'a> = (u64, u64, u64, u64, u64, u64, u64, u64)
type Index<'a> = (u64, u64, u64, u64, u64, u64, u64, u64)
The type of the index pattern for this dimension. Read more
Source§type Vec<T> = [T; 8]
type Vec<T> = [T; 8]
A vec-like container that can hold one value per axis for this dimension type.
Source§fn as_mut_slice(&mut self) -> &mut [u64]
fn as_mut_slice(&mut self) -> &mut [u64]
Return the shape as a mutable slice, with one element per dimension.
Source§fn vec<T>(ndim: usize, f: impl FnMut(usize) -> T) -> Self::Vec<T>
fn vec<T>(ndim: usize, f: impl FnMut(usize) -> T) -> Self::Vec<T>
Build a vec-like container with one value per axis, by applying
f to each axis index.Source§impl IntoDimension for Dim<0>
impl IntoDimension for Dim<0>
Source§impl IntoDimension for Dim<1>
impl IntoDimension for Dim<1>
Source§impl IntoDimension for Dim<2>
impl IntoDimension for Dim<2>
Source§impl IntoDimension for Dim<3>
impl IntoDimension for Dim<3>
Source§impl IntoDimension for Dim<4>
impl IntoDimension for Dim<4>
Source§impl IntoDimension for Dim<5>
impl IntoDimension for Dim<5>
Source§impl IntoDimension for Dim<6>
impl IntoDimension for Dim<6>
Source§impl IntoDimension for Dim<7>
impl IntoDimension for Dim<7>
Auto Trait Implementations§
impl<const NDIM: usize> Freeze for Dim<NDIM>
impl<const NDIM: usize> RefUnwindSafe for Dim<NDIM>
impl<const NDIM: usize> Send for Dim<NDIM>
impl<const NDIM: usize> Sync for Dim<NDIM>
impl<const NDIM: usize> Unpin for Dim<NDIM>
impl<const NDIM: usize> UnsafeUnpin for Dim<NDIM>
impl<const NDIM: usize> UnwindSafe for Dim<NDIM>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<D> IntoDimension for Dwhere
D: Dimension,
impl<D> IntoDimension for Dwhere
D: Dimension,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ShapeArg for Twhere
T: IntoDimension,
impl<T> ShapeArg for Twhere
T: IntoDimension,
Source§impl<T> ShapeBuilder for Twhere
T: IntoDimension,
impl<T> ShapeBuilder for Twhere
T: IntoDimension,
Source§type Dim = <T as IntoDimension>::Dim
type Dim = <T as IntoDimension>::Dim
The type that captures the built shape’s dimensionality.
Source§fn into_shape_with_order(self) -> Shape<<T as ShapeBuilder>::Dim>
fn into_shape_with_order(self) -> Shape<<T as ShapeBuilder>::Dim>
Turn into a contiguous-element
Shape.Source§fn f(self) -> Shape<<T as ShapeBuilder>::Dim>
fn f(self) -> Shape<<T as ShapeBuilder>::Dim>
Convert into a Fortran-order (a.k.a., column-order)
Shape.Source§fn set_f(self, is_f: bool) -> Shape<<T as ShapeBuilder>::Dim>
fn set_f(self, is_f: bool) -> Shape<<T as ShapeBuilder>::Dim>
Set the order of the shape to either Fortran or non-Fortran.
Source§fn strides(self, st: T) -> StrideShape<<T as ShapeBuilder>::Dim>
fn strides(self, st: T) -> StrideShape<<T as ShapeBuilder>::Dim>
Set the strides of the shape.