orx_v

Trait Dim

Source
pub trait Dim:
    Sized
    + Copy
    + Debug
    + PartialEq
    + 'static {
    type Idx: Copy + Debug;
    type ChildIdx: Copy + Debug + From<usize> + Into<usize>;
    type PrevDim: Dim;
    type CardIdx: CardIdx<Self> + Debug;
    type LeqIdx: LeqIdx<Self>;

    // Required methods
    fn dimension() -> usize;
    fn left_join_from_lower_dim(
        left_most_idx: usize,
        lower_idx: <Self::PrevDim as Dim>::Idx,
    ) -> Self::Idx;
    fn left_join_from_lower_card_idx(
        left_most_idx: usize,
        lower_idx: <Self::PrevDim as Dim>::CardIdx,
    ) -> Self::CardIdx;
    fn in_bounds<T>(
        idx: impl IntoIdx<Self>,
        vec: &impl NVecCore<Self, T>,
    ) -> bool;
}
Expand description

Dimensionality of a structure, such as D1 for one-dimensional or D2 for two-dimensional structures.

Required Associated Types§

Source

type Idx: Copy + Debug

Index for this dimensionality.

Source

type ChildIdx: Copy + Debug + From<usize> + Into<usize>

Index to reach a child of a structure with this dimension, while the child belongs to the previous dimension.

Source

type PrevDim: Dim

One level smaller dimension.

Source

type CardIdx: CardIdx<Self> + Debug

Union of indices that can be used to query cardinality of the vector’s any lower dimension children.

Note that these indices belong to lesser dimensions.

For instance, the cardinality index sum of NVec<D2, T> is IdxLeqD1 which is an index of dimension D0 or D1:

  • the only D0 index [] returns the number of children of the vector;
  • the D1 index [i] returns the number of elements in the i-th child of the vector.
Source

type LeqIdx: LeqIdx<Self>

Union of indices that are less than or equal to this dimension.

Required Methods§

Source

fn dimension() -> usize

Name of the dimension.

Source

fn left_join_from_lower_dim( left_most_idx: usize, lower_idx: <Self::PrevDim as Dim>::Idx, ) -> Self::Idx

Left joins the left_most_idx to lover_idx of dimension say N to get the index of dimension N+1.

Source

fn left_join_from_lower_card_idx( left_most_idx: usize, lower_idx: <Self::PrevDim as Dim>::CardIdx, ) -> Self::CardIdx

Left joins the left_most_idx to lover_idx of dimension say N to get the index of dimension N+1.

Source

fn in_bounds<T>(idx: impl IntoIdx<Self>, vec: &impl NVecCore<Self, T>) -> bool

Returns whether or not the idx is in bounds for the given vec.

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.

Implementors§