Trait CircularArrayIndex

Source
pub trait CircularArrayIndex<'a, const N: usize, T: 'a> {
    // Required methods
    fn iter(&'a self) -> impl Iterator<Item = &'a T>;
    fn iter_raw(&'a self) -> impl Iterator<Item = &'a T>;
    fn iter_index(
        &'a self,
        axis: usize,
        index: usize,
    ) -> impl Iterator<Item = &'a T>;
    fn iter_index_raw(
        &'a self,
        axis: usize,
        index: usize,
    ) -> impl Iterator<Item = &'a T>;
    fn iter_range(
        &'a self,
        axis: usize,
        range: Range<usize>,
    ) -> impl Iterator<Item = &'a T>;
    fn iter_range_raw(
        &'a self,
        axis: usize,
        range: Range<usize>,
    ) -> impl Iterator<Item = &'a T>;
    fn iter_slice(
        &'a self,
        slice: [Range<usize>; N],
    ) -> impl Iterator<Item = &'a T>;
    fn get(&'a self, index: [usize; N]) -> &'a T;
    fn get_raw(&'a self, index: [usize; N]) -> &'a T;
}
Expand description

Methods for retrieving elements from the array.

Required Methods§

Source

fn iter(&'a self) -> impl Iterator<Item = &'a T>

Iterate over all elements of the inner array, aligned to the offset.

Source

fn iter_raw(&'a self) -> impl Iterator<Item = &'a T>

Iterate over all elements of the inner array.

Source

fn iter_index( &'a self, axis: usize, index: usize, ) -> impl Iterator<Item = &'a T>

Iterate over all elements of index for the given axis aligned to the offset.

Source

fn iter_index_raw( &'a self, axis: usize, index: usize, ) -> impl Iterator<Item = &'a T>

Iterate over all elements of index for the given axis.

Source

fn iter_range( &'a self, axis: usize, range: Range<usize>, ) -> impl Iterator<Item = &'a T>

Iterate over all elements of the given index range for the given axis aligned to the offset.

Source

fn iter_range_raw( &'a self, axis: usize, range: Range<usize>, ) -> impl Iterator<Item = &'a T>

Iterate over all elements of the given index range for the given axis.

Source

fn iter_slice(&'a self, slice: [Range<usize>; N]) -> impl Iterator<Item = &'a T>

Iterate over all elements of the given index slice.

Source

fn get(&'a self, index: [usize; N]) -> &'a T

Get a reference to the element at the given index, aligned to the offset.

Source

fn get_raw(&'a self, index: [usize; N]) -> &'a T

Get a reference to the element at the given index.

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§

Source§

impl<'a, const N: usize, A: AsRef<[T]>, T: 'a> CircularArrayIndex<'a, N, T> for CircularArray<N, A, T>