Struct Const

Source
pub struct Const<const N: usize>;
Expand description

Type-level constant.

Trait Implementations§

Source§

impl Axis for Const<0>

Source§

type Dim<S: Shape> = <S as Shape>::Head

Corresponding dimension.
Source§

type Init<S: Shape> = ()

Shape for the previous dimensions excluding the current dimension.
Source§

type Rest<S: Shape> = <S as Shape>::Tail

Shape for the next dimensions excluding the current dimension.
Source§

type Remove<S: Shape> = <S as Shape>::Tail

Remove the dimension from the shape.
Source§

type Insert<D: Dim, S: Shape> = <S as Shape>::Prepend<D>

Insert the dimension into the shape.
Source§

fn index(self, rank: usize) -> usize

Returns the dimension index.
Source§

impl Axis for Const<1>

Source§

type Dim<S: Shape> = <Const<0> as Axis>::Dim<<S as Shape>::Tail>

Corresponding dimension.
Source§

type Init<S: Shape> = <<Const<0> as Axis>::Init<<S as Shape>::Tail> as Shape>::Prepend<<S as Shape>::Head>

Shape for the previous dimensions excluding the current dimension.
Source§

type Rest<S: Shape> = <Const<0> as Axis>::Rest<<S as Shape>::Tail>

Shape for the next dimensions excluding the current dimension.
Source§

type Remove<S: Shape> = <<Const<0> as Axis>::Remove<<S as Shape>::Tail> as Shape>::Prepend<<S as Shape>::Head>

Remove the dimension from the shape.
Source§

type Insert<D: Dim, S: Shape> = <<Const<0> as Axis>::Insert<D, <S as Shape>::Tail> as Shape>::Prepend<<S as Shape>::Head>

Insert the dimension into the shape.
Source§

fn index(self, rank: usize) -> usize

Returns the dimension index.
Source§

impl Axis for Const<2>

Source§

type Dim<S: Shape> = <Const<1> as Axis>::Dim<<S as Shape>::Tail>

Corresponding dimension.
Source§

type Init<S: Shape> = <<Const<1> as Axis>::Init<<S as Shape>::Tail> as Shape>::Prepend<<S as Shape>::Head>

Shape for the previous dimensions excluding the current dimension.
Source§

type Rest<S: Shape> = <Const<1> as Axis>::Rest<<S as Shape>::Tail>

Shape for the next dimensions excluding the current dimension.
Source§

type Remove<S: Shape> = <<Const<1> as Axis>::Remove<<S as Shape>::Tail> as Shape>::Prepend<<S as Shape>::Head>

Remove the dimension from the shape.
Source§

type Insert<D: Dim, S: Shape> = <<Const<1> as Axis>::Insert<D, <S as Shape>::Tail> as Shape>::Prepend<<S as Shape>::Head>

Insert the dimension into the shape.
Source§

fn index(self, rank: usize) -> usize

Returns the dimension index.
Source§

impl Axis for Const<3>

Source§

type Dim<S: Shape> = <Const<2> as Axis>::Dim<<S as Shape>::Tail>

Corresponding dimension.
Source§

type Init<S: Shape> = <<Const<2> as Axis>::Init<<S as Shape>::Tail> as Shape>::Prepend<<S as Shape>::Head>

Shape for the previous dimensions excluding the current dimension.
Source§

type Rest<S: Shape> = <Const<2> as Axis>::Rest<<S as Shape>::Tail>

Shape for the next dimensions excluding the current dimension.
Source§

type Remove<S: Shape> = <<Const<2> as Axis>::Remove<<S as Shape>::Tail> as Shape>::Prepend<<S as Shape>::Head>

Remove the dimension from the shape.
Source§

type Insert<D: Dim, S: Shape> = <<Const<2> as Axis>::Insert<D, <S as Shape>::Tail> as Shape>::Prepend<<S as Shape>::Head>

Insert the dimension into the shape.
Source§

fn index(self, rank: usize) -> usize

Returns the dimension index.
Source§

impl Axis for Const<4>

Source§

type Dim<S: Shape> = <Const<3> as Axis>::Dim<<S as Shape>::Tail>

Corresponding dimension.
Source§

type Init<S: Shape> = <<Const<3> as Axis>::Init<<S as Shape>::Tail> as Shape>::Prepend<<S as Shape>::Head>

Shape for the previous dimensions excluding the current dimension.
Source§

type Rest<S: Shape> = <Const<3> as Axis>::Rest<<S as Shape>::Tail>

Shape for the next dimensions excluding the current dimension.
Source§

type Remove<S: Shape> = <<Const<3> as Axis>::Remove<<S as Shape>::Tail> as Shape>::Prepend<<S as Shape>::Head>

Remove the dimension from the shape.
Source§

type Insert<D: Dim, S: Shape> = <<Const<3> as Axis>::Insert<D, <S as Shape>::Tail> as Shape>::Prepend<<S as Shape>::Head>

Insert the dimension into the shape.
Source§

fn index(self, rank: usize) -> usize

Returns the dimension index.
Source§

impl Axis for Const<5>

Source§

type Dim<S: Shape> = <Const<4> as Axis>::Dim<<S as Shape>::Tail>

Corresponding dimension.
Source§

type Init<S: Shape> = <<Const<4> as Axis>::Init<<S as Shape>::Tail> as Shape>::Prepend<<S as Shape>::Head>

Shape for the previous dimensions excluding the current dimension.
Source§

type Rest<S: Shape> = <Const<4> as Axis>::Rest<<S as Shape>::Tail>

Shape for the next dimensions excluding the current dimension.
Source§

type Remove<S: Shape> = <<Const<4> as Axis>::Remove<<S as Shape>::Tail> as Shape>::Prepend<<S as Shape>::Head>

Remove the dimension from the shape.
Source§

type Insert<D: Dim, S: Shape> = <<Const<4> as Axis>::Insert<D, <S as Shape>::Tail> as Shape>::Prepend<<S as Shape>::Head>

Insert the dimension into the shape.
Source§

fn index(self, rank: usize) -> usize

Returns the dimension index.
Source§

impl<const N: usize> Clone for Const<N>

Source§

fn clone(&self) -> Const<N>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<const N: usize> Debug for Const<N>

Source§

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

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

impl<const N: usize> Default for Const<N>

Source§

fn default() -> Const<N>

Returns the “default value” for a type. Read more
Source§

impl<const N: usize> Dim for Const<N>

Source§

const SIZE: Option<usize>

Dimension size if known statically, or None if dynamic.
Source§

type Merge<D: Dim> = Const<N>

Merge dimensions, where constant size is preferred over dynamic.
Source§

fn from_size(size: usize) -> Self

Creates an array dimension with the given size. Read more
Source§

fn size(self) -> usize

Returns the number of elements in the dimension.
Source§

impl<const N: usize> From<Const<N>> for Dyn

Source§

fn from(_: Const<N>) -> Self

Converts to this type from the input type.
Source§

impl<const N: usize> Hash for Const<N>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<const N: usize> IntoShape for Const<N>

Source§

type IntoShape = (Const<N>,)

Which kind of array shape are we turning this into?
Source§

fn into_shape(self) -> Self::IntoShape

Creates an array shape from a value.
Source§

impl<const N: usize> Ord for Const<N>

Source§

fn cmp(&self, other: &Const<N>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<const N: usize> PartialEq for Const<N>

Source§

fn eq(&self, other: &Const<N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const N: usize> PartialOrd for Const<N>

Source§

fn partial_cmp(&self, other: &Const<N>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<const N: usize> TryFrom<usize> for Const<N>

Source§

type Error = usize

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

fn try_from(value: Dyn) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<const N: usize> Copy for Const<N>

Source§

impl<const N: usize> Eq for Const<N>

Source§

impl<const N: usize> StructuralPartialEq for Const<N>

Auto Trait Implementations§

§

impl<const N: usize> Freeze for Const<N>

§

impl<const N: usize> RefUnwindSafe for Const<N>

§

impl<const N: usize> Send for Const<N>

§

impl<const N: usize> Sync for Const<N>

§

impl<const N: usize> Unpin for Const<N>

§

impl<const N: usize> UnwindSafe for Const<N>

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<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<T> IntoCloned<T> for T

Source§

fn clone_to(self, target: &mut T)

Moves an existing object or clones from a reference to the target object.
Source§

fn into_cloned(self) -> T

Returns an existing object or a new clone from a reference.
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.