Trait NdArrayView

Source
pub trait NdArrayView<T>
where T: ArrayElement,
{ type Iter<'a>: Iterator<Item = &'a T> where Self: 'a, T: 'a; // Required methods fn ndim(&self) -> usize; fn dim(&self, index: usize) -> Result<usize, Error>; fn as_slice(&self) -> Option<&[T]>; fn iter(&self) -> Self::Iter<'_>; }

Required Associated Types§

Source

type Iter<'a>: Iterator<Item = &'a T> where Self: 'a, T: 'a

Required Methods§

Source

fn ndim(&self) -> usize

Returns the number of dimensions (rank) of the array.

Source

fn dim(&self, index: usize) -> Result<usize, Error>

Returns the size of the specified dimension.

Source

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

Return the array’s data as a slice, if it is c-major-layout. Return None otherwise.

Source

fn iter(&self) -> Self::Iter<'_>

Return an iterator of references to the elements of the array. Iterator element type is &T.

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<T, D> NdArrayView<T> for ArrayView<'_, T, D>
where T: ArrayElement, D: Dimension,

Source§

type Iter<'a> = Iter<'a, T, D> where Self: 'a, T: 'a

Source§

fn ndim(&self) -> usize

Source§

fn dim(&self, index: usize) -> Result<usize, Error>

Source§

fn iter(&self) -> Self::Iter<'_>

Source§

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

Source§

impl<T: ArrayElement> NdArrayView<T> for &[T]

impl NdArrayView for one dimension slice

Source§

type Iter<'a> = Iter<'a, T> where Self: 'a, T: 'a

Source§

fn ndim(&self) -> usize

Source§

fn dim(&self, idx: usize) -> Result<usize, Error>

Source§

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

Source§

fn iter(&self) -> Self::Iter<'_>

Source§

impl<T: ArrayElement> NdArrayView<T> for Vec<Vec<Vec<T>>>

impl NdArrayView for three dimensions vector

Source§

type Iter<'a> = Flatten<Flatten<Iter<'a, Vec<Vec<T>>>>> where T: 'a

Source§

fn ndim(&self) -> usize

Source§

fn dim(&self, idx: usize) -> Result<usize, Error>

Source§

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

Source§

fn iter(&self) -> Self::Iter<'_>

Source§

impl<T: ArrayElement> NdArrayView<T> for Vec<Vec<T>>

impl NdArrayView for two dimensions vector

Source§

type Iter<'a> = Flatten<Iter<'a, Vec<T>>> where T: 'a

Source§

fn ndim(&self) -> usize

Source§

fn dim(&self, idx: usize) -> Result<usize, Error>

Source§

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

Source§

fn iter(&self) -> Self::Iter<'_>

Source§

impl<T: ArrayElement> NdArrayView<T> for Vec<T>

impl NdArrayView for one dimension vector

Source§

type Iter<'a> = Iter<'a, T> where T: 'a

Source§

fn ndim(&self) -> usize

Source§

fn dim(&self, idx: usize) -> Result<usize, Error>

Source§

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

Source§

fn iter(&self) -> Self::Iter<'_>

Source§

impl<T: ArrayElement, const M: usize> NdArrayView<T> for &[[T; M]]

impl NdArrayView for two dimensions slices

Source§

type Iter<'a> = Flatten<Iter<'a, [T; M]>> where Self: 'a, T: 'a

Source§

fn ndim(&self) -> usize

Source§

fn dim(&self, idx: usize) -> Result<usize, Error>

Source§

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

Source§

fn iter(&self) -> Self::Iter<'_>

Source§

impl<T: ArrayElement, const M: usize, const N: usize> NdArrayView<T> for &[[[T; M]; N]]

Source§

type Iter<'a> = Flatten<Flatten<Iter<'a, [[T; M]; N]>>> where Self: 'a, T: 'a

Source§

fn ndim(&self) -> usize

Source§

fn dim(&self, idx: usize) -> Result<usize, Error>

Source§

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

Source§

fn iter(&self) -> Self::Iter<'_>

Source§

impl<T: ArrayElement, const M: usize, const N: usize> NdArrayView<T> for [[T; M]; N]

impl NdArrayView for two dimensions array

Source§

type Iter<'a> = Flatten<Iter<'a, [T; M]>> where T: 'a

Source§

fn ndim(&self) -> usize

Source§

fn dim(&self, idx: usize) -> Result<usize, Error>

Source§

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

Source§

fn iter(&self) -> Self::Iter<'_>

Source§

impl<T: ArrayElement, const M: usize, const N: usize, const L: usize> NdArrayView<T> for [[[T; M]; N]; L]

impl NdArrayView for three dimensions array

Source§

type Iter<'a> = Flatten<Flatten<Iter<'a, [[T; M]; N]>>> where T: 'a

Source§

fn ndim(&self) -> usize

Source§

fn dim(&self, idx: usize) -> Result<usize, Error>

Source§

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

Source§

fn iter(&self) -> Self::Iter<'_>

Source§

impl<T: ArrayElement, const N: usize> NdArrayView<T> for [T; N]

impl NdArrayView for one dimension array

Source§

type Iter<'a> = Iter<'a, T> where T: 'a

Source§

fn ndim(&self) -> usize

Source§

fn dim(&self, idx: usize) -> Result<usize, Error>

Source§

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

Source§

fn iter(&self) -> Self::Iter<'_>

Implementors§