Shape

Trait Shape 

Source
pub trait Shape:
    Unbind
    + Ord
    + ShapeIdx<Idx<usize>: Ord + Eq + PartialOrd<Self>, IdxInc<usize>: Ord + Eq + PartialOrd<Self>> {
    const IS_BOUND: bool = true;
Show 13 methods // Provided methods fn bind<'n>(self, guard: Guard<'n>) -> Dim<'n> { ... } fn cast_idx_slice<I: Index>(slice: &[Idx<Self, I>]) -> &[I] { ... } fn cast_idx_inc_slice<I: Index>(slice: &[IdxInc<Self, I>]) -> &[I] { ... } fn start() -> IdxInc<Self> { ... } fn next(idx: Idx<Self>) -> IdxInc<Self> { ... } fn end(self) -> IdxInc<Self> { ... } fn idx(self, idx: usize) -> Option<Idx<Self>> { ... } fn idx_inc(self, idx: usize) -> Option<IdxInc<Self>> { ... } fn checked_idx(self, idx: usize) -> Idx<Self> { ... } fn checked_idx_inc(self, idx: usize) -> IdxInc<Self> { ... } unsafe fn unchecked_idx(self, idx: usize) -> Idx<Self> { ... } unsafe fn unchecked_idx_inc(self, idx: usize) -> IdxInc<Self> { ... } fn indices( from: IdxInc<Self>, to: IdxInc<Self>, ) -> impl Clone + ExactSizeIterator + DoubleEndedIterator<Item = Idx<Self>> { ... }
}
Expand description

matrix dimension

Provided Associated Constants§

Source

const IS_BOUND: bool = true

whether the types involved have any safety invariants

Provided Methods§

Source

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]

cast a slice of bound values to unbound values

Source

fn cast_idx_inc_slice<I: Index>(slice: &[IdxInc<Self, I>]) -> &[I]

cast a slice of bound values to unbound values

Source

fn start() -> IdxInc<Self>

returns the index 0, which is always valid

Source

fn next(idx: Idx<Self>) -> IdxInc<Self>

returns the incremented value, as an inclusive index

Source

fn end(self) -> IdxInc<Self>

returns the last value, equal to the dimension

Source

fn idx(self, idx: usize) -> Option<Idx<Self>>

checks if the index is valid, returning Some(_) in that case

Source

fn idx_inc(self, idx: usize) -> Option<IdxInc<Self>>

checks if the index is valid, returning Some(_) in that case

Source

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>

checks if the index is valid, and panics otherwise

Source

unsafe fn unchecked_idx(self, idx: usize) -> Idx<Self>

assumes the index is valid

§safety

the index must be valid

Source

unsafe fn unchecked_idx_inc(self, idx: usize) -> IdxInc<Self>

assumes the index is valid

§safety

the index must be valid

Source

fn indices( from: IdxInc<Self>, to: IdxInc<Self>, ) -> impl Clone + ExactSizeIterator + DoubleEndedIterator<Item = Idx<Self>>

returns an iterator over the indices between from and to

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.

Implementations on Foreign Types§

Source§

impl Shape for usize

Source§

const IS_BOUND: bool = false

Implementors§

Source§

impl Shape for One

Source§

const IS_BOUND: bool = true

Source§

impl<'dim> Shape for Dim<'dim>