Skip to main content

DimDyn

Struct DimDyn 

Source
pub struct DimDyn(/* private fields */);
Expand description

A dynamically-dimensioned shape whose ndim is only known at runtime.

DimDyn stores the shape in a stack-allocated array with capacity NDIM_MAX. It is the fallback when the number of axes cannot be determined at compile time: arrays loaded from files, operations that take &[usize] axis arguments, and dimension-changing operations applied to a DimDyn array all produce DimDyn.

DimDyn::Smaller = DimDyn and DimDyn::Larger = DimDyn: the dimension type stays dynamic through any chain of shape-changing operations. Use Array::into_dim to recover a static Dim<N> when the ndim becomes known.

Trait Implementations§

Source§

impl Clone for DimDyn

Source§

fn clone(&self) -> DimDyn

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DimDyn

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Dimension for DimDyn

Source§

const NDIM: Option<usize> = None

The number of axes, if known at compile time. Read more
Source§

type Smaller = DimDyn

The dimension type that results from removing one axis. Read more
Source§

type Larger = DimDyn

The dimension type that results from adding one axis. Read more
Source§

type Index<'a> = &'a [u64]

The type of the index pattern for this dimension. Read more
Source§

type Vec<T> = ArrayVec<T, NDIM_MAX>

A vec-like container that can hold one value per axis for this dimension type.
Source§

fn from_fn(ndim: usize, f: impl FnMut(usize) -> u64) -> Self

Construct a Dimension by calling f(i) for each axis index i in 0..ndim. Read more
Source§

fn as_slice(&self) -> &[u64]

Return the shape as a slice, with one element per dimension.
Source§

fn as_mut_slice(&mut self) -> &mut [u64]

Return the shape as a mutable slice, with one element per dimension.
Source§

fn to_index(&self) -> Self::Index<'_>

Convert the dimension into its index pattern type.
Source§

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§

fn from_slice(slice: &[u64]) -> Self
where Self: Sized,

Construct a Dimension value from a shape slice. Read more
Source§

fn ndim(&self) -> usize

Return the number of dimensions. Read more
Source§

fn size(&self, dim: usize) -> u64

Return the size of dimension dim. Read more
Source§

impl Index<usize> for DimDyn

Source§

type Output = u64

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl IndexMut<usize> for DimDyn

Source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl IntoDimension for DimDyn

Source§

type Dim = Dim<IxDynImpl>

The concrete type of the resultant dimension.
Source§

fn into_dimension(self) -> Self::Dim

Convert into a type that implements Dimension.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<D> IntoDimension for D
where D: Dimension,

Source§

type Dimension = D

The Dimension type produced by this conversion.
Source§

fn into_dimension(self) -> Result<<D as IntoDimension>::Dimension, Error>

Convert self into a Dimension value. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ShapeArg for T
where T: IntoDimension,

Source§

type Dim = <T as IntoDimension>::Dim

The type that captures the shape’s dimensionality.
Source§

fn into_shape_and_order(self) -> (<T as ShapeArg>::Dim, Option<Order>)

Convert the argument into a shape and an Order.
Source§

impl<T> ShapeBuilder for T
where T: IntoDimension,

Source§

type Dim = <T as IntoDimension>::Dim

The type that captures the built shape’s dimensionality.
Source§

type Strides = T

The type that captures the built shape’s stride pattern.
Source§

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>

Convert into a Fortran-order (a.k.a., column-order) Shape.
Source§

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>

Set the strides of the shape.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.