pub unsafe trait RecursiveArray<T>: Sized {
    const LENGTH: usize;
    const EMPTY: EmptyRecursiveArray = EmptyRecursiveArray;

    // Provided methods
    fn empty() -> EmptyRecursiveArray { ... }
    fn len(&self) -> usize { ... }
    fn from_array<const N: usize>(array: [T; N]) -> Self { ... }
    fn to_array<const N: usize>(self) -> [T; N] { ... }
    fn from_slice(slice: &[T]) -> &Self { ... }
    fn from_mut_slice(slice: &mut [T]) -> &mut Self { ... }
    fn as_slice(&self) -> &[T] { ... }
    fn as_mut_slice(&mut self) -> &mut [T] { ... }
    fn push_back(
        self,
        item: T
    ) -> RecursiveArrayConcatenation<T, Self, RecursiveArraySingleItem<T>> { ... }
    fn append_back<R: RecursiveArray<T>>(
        self,
        array: R
    ) -> RecursiveArrayConcatenation<T, Self, R> { ... }
    fn push_front(
        self,
        item: T
    ) -> RecursiveArrayConcatenation<T, RecursiveArraySingleItem<T>, Self> { ... }
    fn append_front<R: RecursiveArray<T>>(
        self,
        array: R
    ) -> RecursiveArrayConcatenation<T, R, Self> { ... }
}
Expand description

a trait which when implemented by some type states that the type’s memory representation can be treated directly as a slice of type T, with a length that is according to the LENGTH constant.

Required Associated Constants§

source

const LENGTH: usize

the length of this array

Provided Associated Constants§

source

const EMPTY: EmptyRecursiveArray = EmptyRecursiveArray

an empty recursive array.

Provided Methods§

source

fn empty() -> EmptyRecursiveArray

returns an empty recursive array.

source

fn len(&self) -> usize

returns the length of this recursive array.

source

fn from_array<const N: usize>(array: [T; N]) -> Self

converts the given array to a recursive array.

Panics

this function panics if the length of the array (N) is not equal to Self::LENGTH. this condition currently can’t be checked at compile time due to the limitation of const generics.

source

fn to_array<const N: usize>(self) -> [T; N]

converts this recrusive array to a regular array ([T; N]).

Panics

this function panics if the length of the array (N) is not equal to Self::LENGTH. this condition currently can’t be checked at compile time due to the limitation of const generics.

source

fn from_slice(slice: &[T]) -> &Self

converts the given slice to a recursive array reference. this is a zero cost operation, which just casts the slice.

Panics

this function panics if the length of the slice is not equal to Self::LENGTH.

source

fn from_mut_slice(slice: &mut [T]) -> &mut Self

converts the given mutable slice to a recursive array mutable reference. this is a zero cost operation, which just casts the slice.

Panics

this function panics if the length of the slice is not equal to Self::LENGTH.

source

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

returns the elements of this array as a slice.

source

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

returns the elements of this array as a mutable slice.

source

fn push_back( self, item: T ) -> RecursiveArrayConcatenation<T, Self, RecursiveArraySingleItem<T>>

appends an element to the back of this array.

source

fn append_back<R: RecursiveArray<T>>( self, array: R ) -> RecursiveArrayConcatenation<T, Self, R>

appends a recrusive array to the back of this array.

source

fn push_front( self, item: T ) -> RecursiveArrayConcatenation<T, RecursiveArraySingleItem<T>, Self>

appends an element to the fron of this array.

source

fn append_front<R: RecursiveArray<T>>( self, array: R ) -> RecursiveArrayConcatenation<T, R, Self>

appends a recrusive array to the front of this array.

Implementors§