pub struct Dim<'n> { /* private fields */ }Expand description
lifetime branded length
§safety
the type’s safety invariant is that all instances of this type with the same lifetime correspond to the same length.
Implementations§
Source§impl<'n> Dim<'n>
impl<'n> Dim<'n>
Sourcepub fn with<R>(dim: usize, f: impl for<'dim> FnOnce(Dim<'dim>) -> R) -> R
pub fn with<R>(dim: usize, f: impl for<'dim> FnOnce(Dim<'dim>) -> R) -> R
create new branded value with the value dim.
Sourcepub const unsafe fn new_unbound(dim: usize) -> Self
pub const unsafe fn new_unbound(dim: usize) -> Self
Sourcepub const fn partition<'head, 'tail>(
self,
midpoint: IdxInc<'n>,
head: Guard<'head>,
tail: Guard<'tail>,
) -> Partition<'head, 'tail, 'n>
pub const fn partition<'head, 'tail>( self, midpoint: IdxInc<'n>, head: Guard<'head>, tail: Guard<'tail>, ) -> Partition<'head, 'tail, 'n>
partitions self into two segments as specifiedd by the midpoint.
Sourcepub fn head_partition<'head, 'tail>(
self,
head: Dim<'head>,
tail: Guard<'tail>,
) -> Partition<'head, 'tail, 'n>
pub fn head_partition<'head, 'tail>( self, head: Dim<'head>, tail: Guard<'tail>, ) -> Partition<'head, 'tail, 'n>
partitions self into two segments.
Sourcepub fn advance(self, start: Idx<'n>, len: usize) -> IdxInc<'n>
pub fn advance(self, start: Idx<'n>, len: usize) -> IdxInc<'n>
returns start advanced by len units, saturated to self
Sourcepub fn indices(
self,
) -> impl Clone + ExactSizeIterator + DoubleEndedIterator<Item = Idx<'n>>
pub fn indices( self, ) -> impl Clone + ExactSizeIterator + DoubleEndedIterator<Item = Idx<'n>>
returns an iterator over the indices between 0 and self.
Sourcepub fn par_indices(self) -> impl IndexedParallelIterator<Item = Idx<'n>>
pub fn par_indices(self) -> impl IndexedParallelIterator<Item = Idx<'n>>
returns an iterator over the indices between 0 and self.
Source§impl<'size> Dim<'size>
impl<'size> Dim<'size>
Sourcepub fn check<I: Index>(self, idx: I) -> Idx<'size, I>
pub fn check<I: Index>(self, idx: I) -> Idx<'size, I>
check that the index is bounded by self, or panic otherwise.
Sourcepub fn idx<I: Index>(self, idx: I) -> Idx<'size, I>
pub fn idx<I: Index>(self, idx: I) -> Idx<'size, I>
check that the index is bounded by self, or panic otherwise.
Trait Implementations§
Source§impl<'a, 'N, T, Rs: Stride> ColIndex<<Dim<'N> as ShapeIdx>::Idx<usize>> for ColMut<'a, T, Dim<'N>, Rs>
impl<'a, 'N, T, Rs: Stride> ColIndex<<Dim<'N> as ShapeIdx>::Idx<usize>> for ColMut<'a, T, Dim<'N>, Rs>
Source§impl<'a, 'N, T, Rs: Stride> ColIndex<<Dim<'N> as ShapeIdx>::Idx<usize>> for ColRef<'a, T, Dim<'N>, Rs>
impl<'a, 'N, T, Rs: Stride> ColIndex<<Dim<'N> as ShapeIdx>::Idx<usize>> for ColRef<'a, T, Dim<'N>, Rs>
Source§impl<'a, 'M, 'N, T, Rs: Stride, Cs: Stride> MatIndex<<Dim<'M> as ShapeIdx>::Idx<usize>, <Dim<'N> as ShapeIdx>::Idx<usize>> for MatMut<'a, T, Dim<'M>, Dim<'N>, Rs, Cs>
impl<'a, 'M, 'N, T, Rs: Stride, Cs: Stride> MatIndex<<Dim<'M> as ShapeIdx>::Idx<usize>, <Dim<'N> as ShapeIdx>::Idx<usize>> for MatMut<'a, T, Dim<'M>, Dim<'N>, Rs, Cs>
Source§impl<'a, 'M, 'N, T, Rs: Stride, Cs: Stride> MatIndex<<Dim<'M> as ShapeIdx>::Idx<usize>, <Dim<'N> as ShapeIdx>::Idx<usize>> for MatRef<'a, T, Dim<'M>, Dim<'N>, Rs, Cs>
impl<'a, 'M, 'N, T, Rs: Stride, Cs: Stride> MatIndex<<Dim<'M> as ShapeIdx>::Idx<usize>, <Dim<'N> as ShapeIdx>::Idx<usize>> for MatRef<'a, T, Dim<'M>, Dim<'N>, Rs, Cs>
Source§impl<'a, 'M, T, Rs: Stride, Cs: Stride> MatIndex<<Dim<'M> as ShapeIdx>::Idx<usize>, <usize as ShapeIdx>::Idx<usize>> for MatMut<'a, T, Dim<'M>, usize, Rs, Cs>
impl<'a, 'M, T, Rs: Stride, Cs: Stride> MatIndex<<Dim<'M> as ShapeIdx>::Idx<usize>, <usize as ShapeIdx>::Idx<usize>> for MatMut<'a, T, Dim<'M>, usize, Rs, Cs>
Source§impl<'a, 'M, T, Rs: Stride, Cs: Stride> MatIndex<<Dim<'M> as ShapeIdx>::Idx<usize>, <usize as ShapeIdx>::Idx<usize>> for MatRef<'a, T, Dim<'M>, usize, Rs, Cs>
impl<'a, 'M, T, Rs: Stride, Cs: Stride> MatIndex<<Dim<'M> as ShapeIdx>::Idx<usize>, <usize as ShapeIdx>::Idx<usize>> for MatRef<'a, T, Dim<'M>, usize, Rs, Cs>
Source§impl<'a, 'N, C: Shape, T, Rs: Stride, Cs: Stride, ColRange: IntoRange<IdxInc<C>, Len<C>: 'a>> MatIndex<<Dim<'N> as ShapeIdx>::Idx<usize>, ColRange> for MatMut<'a, T, Dim<'N>, C, Rs, Cs>
impl<'a, 'N, C: Shape, T, Rs: Stride, Cs: Stride, ColRange: IntoRange<IdxInc<C>, Len<C>: 'a>> MatIndex<<Dim<'N> as ShapeIdx>::Idx<usize>, ColRange> for MatMut<'a, T, Dim<'N>, C, Rs, Cs>
Source§impl<'a, 'N, C: Shape, T, Rs: Stride, Cs: Stride, ColRange: IntoRange<IdxInc<C>, Len<C>: 'a>> MatIndex<<Dim<'N> as ShapeIdx>::Idx<usize>, ColRange> for MatRef<'a, T, Dim<'N>, C, Rs, Cs>
impl<'a, 'N, C: Shape, T, Rs: Stride, Cs: Stride, ColRange: IntoRange<IdxInc<C>, Len<C>: 'a>> MatIndex<<Dim<'N> as ShapeIdx>::Idx<usize>, ColRange> for MatRef<'a, T, Dim<'N>, C, Rs, Cs>
Source§impl<'a, 'N, T, Rs: Stride, Cs: Stride> MatIndex<<usize as ShapeIdx>::Idx<usize>, <Dim<'N> as ShapeIdx>::Idx<usize>> for MatMut<'a, T, usize, Dim<'N>, Rs, Cs>
impl<'a, 'N, T, Rs: Stride, Cs: Stride> MatIndex<<usize as ShapeIdx>::Idx<usize>, <Dim<'N> as ShapeIdx>::Idx<usize>> for MatMut<'a, T, usize, Dim<'N>, Rs, Cs>
Source§impl<'a, 'N, T, Rs: Stride, Cs: Stride> MatIndex<<usize as ShapeIdx>::Idx<usize>, <Dim<'N> as ShapeIdx>::Idx<usize>> for MatRef<'a, T, usize, Dim<'N>, Rs, Cs>
impl<'a, 'N, T, Rs: Stride, Cs: Stride> MatIndex<<usize as ShapeIdx>::Idx<usize>, <Dim<'N> as ShapeIdx>::Idx<usize>> for MatRef<'a, T, usize, Dim<'N>, Rs, Cs>
Source§impl<'a, 'N, R: Shape, T, Rs: Stride, Cs: Stride, RowRange: IntoRange<IdxInc<R>, Len<R>: 'a>> MatIndex<RowRange, <Dim<'N> as ShapeIdx>::Idx<usize>> for MatMut<'a, T, R, Dim<'N>, Rs, Cs>
impl<'a, 'N, R: Shape, T, Rs: Stride, Cs: Stride, RowRange: IntoRange<IdxInc<R>, Len<R>: 'a>> MatIndex<RowRange, <Dim<'N> as ShapeIdx>::Idx<usize>> for MatMut<'a, T, R, Dim<'N>, Rs, Cs>
Source§impl<'a, 'N, R: Shape, T, Rs: Stride, Cs: Stride, RowRange: IntoRange<IdxInc<R>, Len<R>: 'a>> MatIndex<RowRange, <Dim<'N> as ShapeIdx>::Idx<usize>> for MatRef<'a, T, R, Dim<'N>, Rs, Cs>
impl<'a, 'N, R: Shape, T, Rs: Stride, Cs: Stride, RowRange: IntoRange<IdxInc<R>, Len<R>: 'a>> MatIndex<RowRange, <Dim<'N> as ShapeIdx>::Idx<usize>> for MatRef<'a, T, R, Dim<'N>, Rs, Cs>
Source§impl Ord for Dim<'_>
impl Ord for Dim<'_>
Source§impl<'n, I: Index> PartialOrd<Dim<'n>> for Idx<'n, I>
impl<'n, I: Index> PartialOrd<Dim<'n>> for Idx<'n, I>
Source§impl<'n, I: Index> PartialOrd<Dim<'n>> for IdxInc<'n, I>
impl<'n, I: Index> PartialOrd<Dim<'n>> for IdxInc<'n, I>
Source§impl PartialOrd for Dim<'_>
impl PartialOrd for Dim<'_>
Source§impl<'a, 'N, T, Cs: Stride> RowIndex<<Dim<'N> as ShapeIdx>::Idx<usize>> for RowMut<'a, T, Dim<'N>, Cs>
impl<'a, 'N, T, Cs: Stride> RowIndex<<Dim<'N> as ShapeIdx>::Idx<usize>> for RowMut<'a, T, Dim<'N>, Cs>
Source§impl<'a, 'N, T, Cs: Stride> RowIndex<<Dim<'N> as ShapeIdx>::Idx<usize>> for RowRef<'a, T, Dim<'N>, Cs>
impl<'a, 'N, T, Cs: Stride> RowIndex<<Dim<'N> as ShapeIdx>::Idx<usize>> for RowRef<'a, T, Dim<'N>, Cs>
Source§impl<'dim> Shape for Dim<'dim>
impl<'dim> Shape for Dim<'dim>
Source§fn bind<'n>(self, guard: Guard<'n>) -> Dim<'n>
fn bind<'n>(self, guard: Guard<'n>) -> Dim<'n>
bind the current value using a invariant lifetime guard
Source§fn cast_idx_slice<I: Index>(slice: &[Idx<Self, I>]) -> &[I]
fn cast_idx_slice<I: Index>(slice: &[Idx<Self, I>]) -> &[I]
cast a slice of bound values to unbound values
Source§fn cast_idx_inc_slice<I: Index>(slice: &[IdxInc<Self, I>]) -> &[I]
fn cast_idx_inc_slice<I: Index>(slice: &[IdxInc<Self, I>]) -> &[I]
cast a slice of bound values to unbound values
Source§fn idx(self, idx: usize) -> Option<Idx<Self>>
fn idx(self, idx: usize) -> Option<Idx<Self>>
checks if the index is valid, returning
Some(_) in that caseSource§fn idx_inc(self, idx: usize) -> Option<IdxInc<Self>>
fn idx_inc(self, idx: usize) -> Option<IdxInc<Self>>
checks if the index is valid, returning
Some(_) in that caseSource§fn checked_idx(self, idx: usize) -> Idx<Self>
fn checked_idx(self, idx: usize) -> Idx<Self>
checks if the index is valid, and panics otherwise
Source§fn checked_idx_inc(self, idx: usize) -> IdxInc<Self>
fn checked_idx_inc(self, idx: usize) -> IdxInc<Self>
checks if the index is valid, and panics otherwise
Source§unsafe fn unchecked_idx_inc(self, idx: usize) -> IdxInc<Self>
unsafe fn unchecked_idx_inc(self, idx: usize) -> IdxInc<Self>
assumes the index is valid Read more
Source§fn indices(
from: IdxInc<Self>,
to: IdxInc<Self>,
) -> impl Clone + ExactSizeIterator + DoubleEndedIterator<Item = Idx<Self>>
fn indices( from: IdxInc<Self>, to: IdxInc<Self>, ) -> impl Clone + ExactSizeIterator + DoubleEndedIterator<Item = Idx<Self>>
returns an iterator over the indices between
from and toimpl<'n> Copy for Dim<'n>
impl Eq for Dim<'_>
Auto Trait Implementations§
impl<'n> Freeze for Dim<'n>
impl<'n> RefUnwindSafe for Dim<'n>
impl<'n> Send for Dim<'n>
impl<'n> Sync for Dim<'n>
impl<'n> Unpin for Dim<'n>
impl<'n> UnwindSafe for Dim<'n>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more