View

Struct View 

Source
pub struct View<'a, T, S: Shape = DynRank, L: Layout = Dense> { /* private fields */ }
Expand description

Multidimensional array view.

Implementations§

Source§

impl<'a, T, S: Shape, L: Layout> View<'a, T, S, L>

Source

pub fn into_at(self, index: usize) -> View<'a, T, S::Tail, L>

Converts the array view into a new array view indexing the first dimension.

§Panics

Panics if the index is out of bounds, or if the rank is not at least 1.

Source

pub fn into_axis_at<A: Axis>( self, axis: A, index: usize, ) -> View<'a, T, A::Remove<S>, Split<A, S, L>>

Converts the array view into a new array view indexing the specified dimension.

If the dimension to be indexed is know at compile time, the resulting array shape will maintain constant-sized dimensions. Furthermore, if it is the first dimension the resulting array view has the same layout as the input.

§Panics

Panics if the dimension or the index is out of bounds.

Source

pub fn into_col(self, index: usize) -> View<'a, T, (S::Head,), Strided>

Converts the array view into a new array view for the specified column.

§Panics

Panics if the rank is not equal to 2, or if the index is out of bounds.

Source

pub fn into_diag(self, index: isize) -> View<'a, T, (Dyn,), Strided>

Converts the array view into a new array view for the given diagonal, where index > 0 is above and index < 0 is below the main diagonal.

§Panics

Panics if the rank is not equal to 2, or if the absolute index is larger than the number of columns or rows.

Source

pub fn into_dyn(self) -> View<'a, T, DynRank, L>

Converts the array view into an array view with dynamic rank.

Source

pub fn into_flat(self) -> View<'a, T, (Dyn,), L>

Converts the array view into a one-dimensional array view.

§Panics

Panics if the array layout is not uniformly strided.

Source

pub fn into_mapping<R: Shape, K: Layout>(self) -> View<'a, T, R, K>

Converts the array view into a remapped array view.

§Panics

Panics if the shape is not matching static rank or constant-sized dimensions, or if the memory layout is not compatible with the new array layout.

Source

pub fn into_permuted<I: IntoShape<IntoShape: Permutation>>( self, perm: I, ) -> View<'a, T, <I::IntoShape as Permutation>::Shape<S>, <I::IntoShape as Permutation>::Layout<L>>

Converts the array view into a new array view with the dimensions permuted.

If the permutation is an identity permutation and known at compile time, the resulting array view has the same layout as the input. For example, permuting with (Const::<0>, Const::<1>) will maintain the layout while permuting with [0, 1] gives strided layout.

§Panics

Panics if the permutation is not valid.

Source

pub fn into_reordered( self, ) -> View<'a, T, S::Reverse, <S::Tail as Shape>::Layout<L>>

👎Deprecated

Converts the array view into a reordered array view.

This method is deprecated, use into_transposed instead.

Source

pub fn into_row( self, index: usize, ) -> View<'a, T, (<S::Tail as Shape>::Head,), L>

Converts the array view into a new array view for the specified row.

§Panics

Panics if the rank is not equal to 2, or if the index is out of bounds.

Source

pub fn into_shape<I: IntoShape>(self, shape: I) -> View<'a, T, I::IntoShape, L>

Converts the array view into a reshaped array view.

At most one dimension can have dynamic size usize::MAX, and is then inferred from the other dimensions and the array length.

§Examples
use mdarray::view;

let v = view![[1, 2, 3], [4, 5, 6]];

assert_eq!(v.into_shape([!0, 2]), view![[1, 2], [3, 4], [5, 6]]);
§Panics

Panics if the array length is changed, or if the memory layout is not compatible.

Source

pub fn into_split_at( self, mid: usize, ) -> (View<'a, T, Resize<Const<0>, S>, L>, View<'a, T, Resize<Const<0>, S>, L>)

Divides the array view into two at an index along the first dimension.

§Panics

Panics if the split point is larger than the number of elements in that dimension, or if the rank is not at least 1.

Source

pub fn into_split_axis_at<A: Axis>( self, axis: A, mid: usize, ) -> (View<'a, T, Resize<A, S>, Split<A, S, L>>, View<'a, T, Resize<A, S>, Split<A, S, L>>)

Divides the array view into two at an index along the specified dimension.

If the dimension to be divided is know at compile time, the resulting array shape will maintain constant-sized dimensions. Furthermore, if it is the first dimension the resulting array views have the same layout as the input.

§Panics

Panics if the split point is larger than the number of elements in that dimension, or if the dimension is out of bounds.

Source

pub fn into_transposed( self, ) -> View<'a, T, S::Reverse, <S::Tail as Shape>::Layout<L>>

Converts the array view into a transposed array view, where the dimensions are reversed.

Source

pub unsafe fn new_unchecked(ptr: *const T, mapping: L::Mapping<S>) -> Self

Creates an array view from a raw pointer and layout.

§Safety

The pointer must be non-null and a valid array view for the given layout.

Source§

impl<'a, T, X: Dim, L: Layout> View<'a, T, (X,), L>

Source

pub fn into_view<A: DimIndex>( self, a: A, ) -> View<'a, T, <(A,) as ViewIndex>::Shape<(X,)>, <(A,) as ViewIndex>::Layout<L>>

Converts the array view into a new array view for the specified subarray.

§Panics

Panics if the subarray is out of bounds.

Source§

impl<'a, T, X: Dim, Y: Dim, L: Layout> View<'a, T, (X, Y), L>

Source

pub fn into_view<A: DimIndex, B: DimIndex>( self, a: A, b: B, ) -> View<'a, T, <(A, B) as ViewIndex>::Shape<(X, Y)>, <(A, B) as ViewIndex>::Layout<L>>

Converts the array view into a new array view for the specified subarray.

§Panics

Panics if the subarray is out of bounds.

Source§

impl<'a, T, X: Dim, Y: Dim, Z: Dim, L: Layout> View<'a, T, (X, Y, Z), L>

Source

pub fn into_view<A: DimIndex, B: DimIndex, C: DimIndex>( self, a: A, b: B, c: C, ) -> View<'a, T, <(A, B, C) as ViewIndex>::Shape<(X, Y, Z)>, <(A, B, C) as ViewIndex>::Layout<L>>

Converts the array view into a new array view for the specified subarray.

§Panics

Panics if the subarray is out of bounds.

Source§

impl<'a, T, X: Dim, Y: Dim, Z: Dim, W: Dim, L: Layout> View<'a, T, (X, Y, Z, W), L>

Source

pub fn into_view<A: DimIndex, B: DimIndex, C: DimIndex, D: DimIndex>( self, a: A, b: B, c: C, d: D, ) -> View<'a, T, <(A, B, C, D) as ViewIndex>::Shape<(X, Y, Z, W)>, <(A, B, C, D) as ViewIndex>::Layout<L>>

Converts the array view into a new array view for the specified subarray.

§Panics

Panics if the subarray is out of bounds.

Source§

impl<'a, T, X: Dim, Y: Dim, Z: Dim, W: Dim, U: Dim, L: Layout> View<'a, T, (X, Y, Z, W, U), L>

Source

pub fn into_view<A: DimIndex, B: DimIndex, C: DimIndex, D: DimIndex, E: DimIndex>( self, a: A, b: B, c: C, d: D, e: E, ) -> View<'a, T, <(A, B, C, D, E) as ViewIndex>::Shape<(X, Y, Z, W, U)>, <(A, B, C, D, E) as ViewIndex>::Layout<L>>

Converts the array view into a new array view for the specified subarray.

§Panics

Panics if the subarray is out of bounds.

Source§

impl<'a, T, X: Dim, Y: Dim, Z: Dim, W: Dim, U: Dim, V: Dim, L: Layout> View<'a, T, (X, Y, Z, W, U, V), L>

Source

pub fn into_view<A: DimIndex, B: DimIndex, C: DimIndex, D: DimIndex, E: DimIndex, F: DimIndex>( self, a: A, b: B, c: C, d: D, e: E, f: F, ) -> View<'a, T, <(A, B, C, D, E, F) as ViewIndex>::Shape<(X, Y, Z, W, U, V)>, <(A, B, C, D, E, F) as ViewIndex>::Layout<L>>

Converts the array view into a new array view for the specified subarray.

§Panics

Panics if the subarray is out of bounds.

Methods from Deref<Target = Slice<T, S, L>>§

Source

pub fn as_ptr(&self) -> *const T

Returns a raw pointer to the array buffer.

Source

pub fn at(&self, index: usize) -> View<'_, T, S::Tail, L>

Returns an array view after indexing the first dimension.

§Panics

Panics if the index is out of bounds, or if the rank is not at least 1.

Source

pub fn axis_at<A: Axis>( &self, axis: A, index: usize, ) -> View<'_, T, A::Remove<S>, Split<A, S, L>>

Returns an array view after indexing the specified dimension.

If the dimension to be indexed is know at compile time, the resulting array shape will maintain constant-sized dimensions. Furthermore, if it is the first dimension the resulting array view has the same layout as the input.

§Panics

Panics if the dimension or the index is out of bounds.

Source

pub fn axis_expr<A: Axis>(&self, axis: A) -> AxisExpr<'_, T, S, L, A>

Returns an expression that gives array views iterating over the specified dimension.

If the dimension to be iterated over is know at compile time, the resulting array shape will maintain constant-sized dimensions. Furthermore, if it is the first dimension the resulting array views have the same layout as the input.

§Panics

Panics if the dimension is out of bounds.

Source

pub fn col(&self, index: usize) -> View<'_, T, (S::Head,), Strided>

Returns an array view for the specified column.

§Panics

Panics if the rank is not equal to 2, or if the index is out of bounds.

Source

pub fn cols(&self) -> Lanes<'_, T, S, L, Cols>

Returns an expression that gives column views iterating over the other dimensions.

§Panics

Panics if the rank is not at least 2.

Source

pub fn contains(&self, x: &T) -> bool
where T: PartialEq,

Returns true if the array slice contains an element with the given value.

Source

pub fn diag(&self, index: isize) -> View<'_, T, (Dyn,), Strided>

Returns an array view for the given diagonal of the array slice, where index > 0 is above and index < 0 is below the main diagonal.

§Panics

Panics if the rank is not equal to 2, or if the absolute index is larger than the number of columns or rows.

Source

pub fn dim(&self, index: usize) -> usize

Returns the number of elements in the specified dimension.

§Panics

Panics if the dimension is out of bounds.

Source

pub fn expr(&self) -> View<'_, T, S, L>

Returns an expression over the array slice.

Source

pub fn flatten(&self) -> View<'_, T, (Dyn,), L>

Returns a one-dimensional array view of the array slice.

§Panics

Panics if the array layout is not uniformly strided.

Source

pub unsafe fn get_unchecked<I: SliceIndex<T, S, L>>( &self, index: I, ) -> &I::Output

Returns a reference to an element or a subslice, without doing bounds checking.

§Safety

The index must be within bounds of the array slice.

Source

pub fn is_contiguous(&self) -> bool

Returns true if the array strides are consistent with contiguous memory layout.

Source

pub fn is_empty(&self) -> bool

Returns true if the array contains no elements.

Source

pub fn iter(&self) -> Iter<View<'_, T, S, L>>

Returns an iterator over the array slice.

Source

pub fn lanes<A: Axis>(&self, axis: A) -> Lanes<'_, T, S, L, A>

Returns an expression that gives array views over the specified dimension, iterating over the other dimensions.

If the dimension to give array views over is know at compile time, the resulting shape will maintain a constant-sized dimension. Furthermore, if it is the last dimension the resulting array views have the same layout as the input.

§Panics

Panics if the dimension is out of bounds.

Source

pub fn len(&self) -> usize

Returns the number of elements in the array.

Source

pub fn mapping(&self) -> &L::Mapping<S>

Returns the array layout mapping.

Source

pub fn outer_expr(&self) -> AxisExpr<'_, T, S, L, Const<0>>

Returns an expression that gives array views iterating over the first dimension.

Iterating over the first dimension results in array views with the same layout as the input.

§Panics

Panics if the rank is not at least 1.

Source

pub fn permute<I: IntoShape<IntoShape: Permutation>>( &self, perm: I, ) -> View<'_, T, <I::IntoShape as Permutation>::Shape<S>, <I::IntoShape as Permutation>::Layout<L>>

Returns an array view with the dimensions permuted.

If the permutation is an identity permutation and known at compile time, the resulting array view has the same layout as the input. For example, permuting with (Const::<0>, Const::<1>) will maintain the layout while permuting with [0, 1] gives strided layout.

§Panics

Panics if the permutation is not valid.

Source

pub fn rank(&self) -> usize

Returns the array rank, i.e. the number of dimensions.

Source

pub fn remap<R: Shape, K: Layout>(&self) -> View<'_, T, R, K>

Returns a remapped array view of the array slice.

§Panics

Panics if the memory layout is not compatible with the new array layout.

Source

pub fn reorder(&self) -> View<'_, T, S::Reverse, <S::Tail as Shape>::Layout<L>>

👎Deprecated

Returns a reordered array view of the array slice.

This method is deprecated, use transpose instead.

Source

pub fn reshape<I: IntoShape>(&self, shape: I) -> View<'_, T, I::IntoShape, L>

Returns a reshaped array view of the array slice.

At most one dimension can have dynamic size usize::MAX, and is then inferred from the other dimensions and the array length.

§Examples
use mdarray::view;

let v = view![[1, 2, 3], [4, 5, 6]];

assert_eq!(v.reshape([!0, 2]), view![[1, 2], [3, 4], [5, 6]]);
§Panics

Panics if the array length is changed, or if the memory layout is not compatible.

Source

pub fn row(&self, index: usize) -> View<'_, T, (<S::Tail as Shape>::Head,), L>

Returns an array view for the specified row.

§Panics

Panics if the rank is not equal to 2, or if the index is out of bounds.

Source

pub fn rows(&self) -> Lanes<'_, T, S, L, Rows>

Returns an expression that gives row views iterating over the other dimensions.

§Panics

Panics if the rank is not at least 1.

Source

pub fn shape(&self) -> &S

Returns the array shape.

Source

pub fn split_at( &self, mid: usize, ) -> (View<'_, T, Resize<Const<0>, S>, L>, View<'_, T, Resize<Const<0>, S>, L>)

Divides an array slice into two at an index along the first dimension.

§Panics

Panics if the split point is larger than the number of elements in that dimension, or if the rank is not at least 1.

Source

pub fn split_axis_at<A: Axis>( &self, axis: A, mid: usize, ) -> (View<'_, T, Resize<A, S>, Split<A, S, L>>, View<'_, T, Resize<A, S>, Split<A, S, L>>)

Divides an array slice into two at an index along the specified dimension.

If the dimension to be divided is know at compile time, the resulting array shape will maintain constant-sized dimensions. Furthermore, if it is the first dimension the resulting array views have the same layout as the input.

§Panics

Panics if the split point is larger than the number of elements in that dimension, or if the dimension is out of bounds.

Source

pub fn stride(&self, index: usize) -> isize

Returns the distance between elements in the specified dimension.

§Panics

Panics if the dimension is out of bounds.

Source

pub fn to_array(&self) -> Array<T, S>
where T: Clone, S: ConstShape,

Copies the array slice into a new array.

Source

pub fn to_tensor(&self) -> Tensor<T, S>
where T: Clone,

Copies the array slice into a new array.

Source

pub fn to_vec(&self) -> Vec<T>
where T: Clone,

Copies the array slice into a new vector.

Source

pub fn transpose( &self, ) -> View<'_, T, S::Reverse, <S::Tail as Shape>::Layout<L>>

Returns a transposed array view of the array slice, where the dimensions are reversed.

Trait Implementations§

Source§

impl<'a, T, U, S: Shape, L: Layout, I: Apply<U>> Add<I> for &'a View<'_, T, S, L>
where &'a T: Add<I::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<&'a View<'_, T, S, L>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: I) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a, T, U, S: Shape, L: Layout, I: Apply<U>> Add<I> for View<'a, T, S, L>
where &'a T: Add<I::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<View<'a, T, S, L>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: I) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a, T, U, S: Shape, L: Layout> Apply<U> for &'a View<'_, T, S, L>

Source§

type Output<F: FnMut(&'a T) -> U> = Map<<&'a View<'_, T, S, L> as IntoExpression>::IntoExpr, F>

The resulting type after applying a closure.
Source§

type ZippedWith<I: IntoExpression, F: FnMut((&'a T, I::Item)) -> U> = Map<Zip<<&'a View<'_, T, S, L> as IntoExpression>::IntoExpr, <I as IntoExpression>::IntoExpr>, F>

The resulting type after zipping elements and applying a closure.
Source§

fn apply<F: FnMut(&'a T) -> U>(self, f: F) -> Self::Output<F>

Returns the array or an expression with the given closure applied to each element.
Source§

fn zip_with<I: IntoExpression, F>(self, expr: I, f: F) -> Self::ZippedWith<I, F>
where F: FnMut((&'a T, I::Item)) -> U,

Returns the array or an expression with the given closure applied to zipped element pairs.
Source§

impl<T, U: ?Sized, S: Shape, L: Layout> AsRef<U> for View<'_, T, S, L>
where Slice<T, S, L>: AsRef<U>,

Source§

fn as_ref(&self) -> &U

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'a, T, U, S: Shape, L: Layout, I: Apply<U>> BitAnd<I> for &'a View<'_, T, S, L>
where &'a T: BitAnd<I::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<&'a View<'_, T, S, L>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: I) -> Self::Output

Performs the & operation. Read more
Source§

impl<'a, T, U, S: Shape, L: Layout, I: Apply<U>> BitAnd<I> for View<'a, T, S, L>
where &'a T: BitAnd<I::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<View<'a, T, S, L>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: I) -> Self::Output

Performs the & operation. Read more
Source§

impl<'a, T, U, S: Shape, L: Layout, I: Apply<U>> BitOr<I> for &'a View<'_, T, S, L>
where &'a T: BitOr<I::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<&'a View<'_, T, S, L>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: I) -> Self::Output

Performs the | operation. Read more
Source§

impl<'a, T, U, S: Shape, L: Layout, I: Apply<U>> BitOr<I> for View<'a, T, S, L>
where &'a T: BitOr<I::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<View<'a, T, S, L>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: I) -> Self::Output

Performs the | operation. Read more
Source§

impl<'a, T, U, S: Shape, L: Layout, I: Apply<U>> BitXor<I> for &'a View<'_, T, S, L>
where &'a T: BitXor<I::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<&'a View<'_, T, S, L>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: I) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<'a, T, U, S: Shape, L: Layout, I: Apply<U>> BitXor<I> for View<'a, T, S, L>
where &'a T: BitXor<I::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<View<'a, T, S, L>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: I) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<T, S: Shape, L: Layout> Borrow<Slice<T, S, L>> for View<'_, T, S, L>

Source§

fn borrow(&self) -> &Slice<T, S, L>

Immutably borrows from an owned value. Read more
Source§

impl<T, S: Shape, L: Layout> Clone for View<'_, T, S, L>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug, S: Shape, L: Layout> Debug for View<'_, T, S, L>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T, S: Shape, L: Layout> Deref for View<'_, T, S, L>

Source§

type Target = Slice<T, S, L>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'a, T, U, S: Shape, L: Layout, I: Apply<U>> Div<I> for &'a View<'_, T, S, L>
where &'a T: Div<I::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<&'a View<'_, T, S, L>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: I) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a, T, U, S: Shape, L: Layout, I: Apply<U>> Div<I> for View<'a, T, S, L>
where &'a T: Div<I::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<View<'a, T, S, L>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: I) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a, T, S: Shape, L: Layout> Expression for View<'a, T, S, L>

Source§

const IS_REPEATABLE: bool = true

True if the expression can be restarted from the beginning after the last element.
Source§

type Shape = S

Array shape type.
Source§

fn shape(&self) -> &S

Returns the array shape.
Source§

fn cloned<'a, T: 'a + Clone>(self) -> Cloned<Self>
where Self: Expression<Item = &'a T> + Sized,

Creates an expression which clones all of its elements.
Source§

fn copied<'a, T: 'a + Copy>(self) -> Copied<Self>
where Self: Expression<Item = &'a T> + Sized,

Creates an expression which copies all of its elements.
Source§

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

Returns the number of elements in the specified dimension. Read more
Source§

fn enumerate(self) -> Enumerate<Self>
where Self: Sized,

Creates an expression which gives tuples of the current count and the element.
Source§

fn eq<I: IntoExpression>(self, other: I) -> bool
where Self: Expression<Item: PartialEq<I::Item>> + Sized,

Determines if the elements of the expression are equal to those of another.
Source§

fn eq_by<I: IntoExpression, F>(self, other: I, eq: F) -> bool
where Self: Sized, F: FnMut(Self::Item, I::Item) -> bool,

Determines if the elements of the expression are equal to those of another with respect to the specified equality function.
Source§

fn eval(self) -> <Self::Shape as Shape>::Owned<Self::Item>
where Self: Sized,

Evaluates the expression into a new array. Read more
Source§

fn eval_into<S: Shape, A: Allocator>( self, tensor: &mut Tensor<Self::Item, S, A>, ) -> &mut Tensor<Self::Item, S, A>
where Self: Sized,

Evaluates the expression with broadcasting and appends to the given array along the first dimension. Read more
Source§

fn fold<T, F: FnMut(T, Self::Item) -> T>(self, init: T, f: F) -> T
where Self: Sized,

Folds all elements into an accumulator by applying an operation, and returns the result.
Source§

fn for_each<F: FnMut(Self::Item)>(self, f: F)
where Self: Sized,

Calls a closure on each element of the expression.
Source§

fn is_empty(&self) -> bool

Returns true if the array contains no elements.
Source§

fn len(&self) -> usize

Returns the number of elements in the array.
Source§

fn map<T, F: FnMut(Self::Item) -> T>(self, f: F) -> Map<Self, F>
where Self: Sized,

Creates an expression that calls a closure on each element.
Source§

fn ne<I: IntoExpression>(self, other: I) -> bool
where Self: Expression<Item: PartialEq<I::Item>> + Sized,

Determines if the elements of the expression are not equal to those of another.
Source§

fn rank(&self) -> usize

Returns the array rank, i.e. the number of dimensions.
Source§

fn zip<I: IntoExpression>(self, other: I) -> Zip<Self, I::IntoExpr>
where Self: Sized,

Creates an expression that gives tuples (x, y) of the elements from each expression. Read more
Source§

impl<'a, T, X: Dim + From<Const<A>>, Y: Dim + From<Const<B>>, Z: Dim + From<Const<C>>, W: Dim + From<Const<D>>, U: Dim + From<Const<E>>, V: Dim + From<Const<F>>, const A: usize, const B: usize, const C: usize, const D: usize, const E: usize, const F: usize> From<&'a [[[[[[T; F]; E]; D]; C]; B]; A]> for View<'a, T, (X, Y, Z, W, U, V)>

Source§

fn from(value: &'a [[[[[[T; F]; E]; D]; C]; B]; A]) -> Self

Converts to this type from the input type.
Source§

impl<'a, T, X: Dim + From<Const<A>>, Y: Dim + From<Const<B>>, Z: Dim + From<Const<C>>, W: Dim + From<Const<D>>, U: Dim + From<Const<E>>, const A: usize, const B: usize, const C: usize, const D: usize, const E: usize> From<&'a [[[[[T; E]; D]; C]; B]; A]> for View<'a, T, (X, Y, Z, W, U)>

Source§

fn from(value: &'a [[[[[T; E]; D]; C]; B]; A]) -> Self

Converts to this type from the input type.
Source§

impl<'a, T, X: Dim + From<Const<A>>, Y: Dim + From<Const<B>>, Z: Dim + From<Const<C>>, W: Dim + From<Const<D>>, const A: usize, const B: usize, const C: usize, const D: usize> From<&'a [[[[T; D]; C]; B]; A]> for View<'a, T, (X, Y, Z, W)>

Source§

fn from(value: &'a [[[[T; D]; C]; B]; A]) -> Self

Converts to this type from the input type.
Source§

impl<'a, T, X: Dim + From<Const<A>>, Y: Dim + From<Const<B>>, Z: Dim + From<Const<C>>, const A: usize, const B: usize, const C: usize> From<&'a [[[T; C]; B]; A]> for View<'a, T, (X, Y, Z)>

Source§

fn from(value: &'a [[[T; C]; B]; A]) -> Self

Converts to this type from the input type.
Source§

impl<'a, T, X: Dim + From<Const<A>>, Y: Dim + From<Const<B>>, const A: usize, const B: usize> From<&'a [[T; B]; A]> for View<'a, T, (X, Y)>

Source§

fn from(value: &'a [[T; B]; A]) -> Self

Converts to this type from the input type.
Source§

impl<'a, T> From<&'a [T]> for View<'a, T, (Dyn,)>

Source§

fn from(value: &'a [T]) -> Self

Converts to this type from the input type.
Source§

impl<'a, T, X: Dim + From<Const<A>>, const A: usize> From<&'a [T; A]> for View<'a, T, (X,)>

Source§

fn from(value: &'a [T; A]) -> Self

Converts to this type from the input type.
Source§

impl<'a, T, S: Shape, L: Layout, I> From<&'a I> for View<'a, T, S, L>
where &'a I: IntoExpression<IntoExpr = View<'a, T, S, L>>,

Source§

fn from(value: &'a I) -> Self

Converts to this type from the input type.
Source§

impl<'a, T, D: Dim> From<View<'a, T, (D,)>> for &'a [T]

Source§

fn from(value: View<'_, T, (D,)>) -> Self

Converts to this type from the input type.
Source§

impl<T: Hash, S: Shape, L: Layout> Hash for View<'_, T, S, L>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T, S: Shape, L: Layout, I: SliceIndex<T, S, L>> Index<I> for View<'_, T, S, L>

Source§

type Output = <I as SliceIndex<T, S, L>>::Output

The returned type after indexing.
Source§

fn index(&self, index: I) -> &I::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a, T, S: Shape, L: Layout> IntoExpression for &'a View<'_, T, S, L>

Source§

type Shape = S

Array shape type.
Source§

type IntoExpr = View<'a, T, S, L>

Which kind of expression are we turning this into?
Source§

fn into_expr(self) -> Self::IntoExpr

Creates an expression from a value.
Source§

impl<'a, T, S: Shape, L: Layout> IntoIterator for &'a View<'_, T, S, L>

Source§

type Item = &'a T

The type of the elements being iterated over.
Source§

type IntoIter = Iter<View<'a, T, S, L>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T, S: Shape, L: Layout> IntoIterator for View<'a, T, S, L>

Source§

type Item = &'a T

The type of the elements being iterated over.
Source§

type IntoIter = Iter<View<'a, T, S, L>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Iter<Self>

Creates an iterator from a value. Read more
Source§

impl<'a, T, U, S: Shape, L: Layout, I: Apply<U>> Mul<I> for &'a View<'_, T, S, L>
where &'a T: Mul<I::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<&'a View<'_, T, S, L>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: I) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a, T, U, S: Shape, L: Layout, I: Apply<U>> Mul<I> for View<'a, T, S, L>
where &'a T: Mul<I::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<View<'a, T, S, L>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: I) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a, T, U, S: Shape, L: Layout> Neg for &'a View<'_, T, S, L>
where &'a T: Neg<Output = U>,

Source§

type Output = <&'a View<'_, T, S, L> as Apply<U>>::Output<fn(&'a T) -> U>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<'a, T, U, S: Shape, L: Layout> Neg for View<'a, T, S, L>
where &'a T: Neg<Output = U>,

Source§

type Output = <View<'a, T, S, L> as Apply<U>>::Output<fn(&'a T) -> U>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<'a, T, U, S: Shape, L: Layout> Not for &'a View<'_, T, S, L>
where &'a T: Not<Output = U>,

Source§

type Output = <&'a View<'_, T, S, L> as Apply<U>>::Output<fn(&'a T) -> U>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<'a, T, U, S: Shape, L: Layout> Not for View<'a, T, S, L>
where &'a T: Not<Output = U>,

Source§

type Output = <View<'a, T, S, L> as Apply<U>>::Output<fn(&'a T) -> U>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<T, U, S: Shape, R: Shape, L: Layout, K: Layout, I: ?Sized> PartialEq<I> for View<'_, T, S, L>
where for<'a> &'a I: IntoExpression<IntoExpr = View<'a, U, R, K>>, T: PartialEq<U>,

Source§

fn eq(&self, other: &I) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, T, U, S: Shape, L: Layout, I: Apply<U>> Rem<I> for &'a View<'_, T, S, L>
where &'a T: Rem<I::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<&'a View<'_, T, S, L>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: I) -> Self::Output

Performs the % operation. Read more
Source§

impl<'a, T, U, S: Shape, L: Layout, I: Apply<U>> Rem<I> for View<'a, T, S, L>
where &'a T: Rem<I::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<View<'a, T, S, L>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: I) -> Self::Output

Performs the % operation. Read more
Source§

impl<'a, T, U, S: Shape, L: Layout, I: Apply<U>> Shl<I> for &'a View<'_, T, S, L>
where &'a T: Shl<I::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<&'a View<'_, T, S, L>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: I) -> Self::Output

Performs the << operation. Read more
Source§

impl<'a, T, U, S: Shape, L: Layout, I: Apply<U>> Shl<I> for View<'a, T, S, L>
where &'a T: Shl<I::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<View<'a, T, S, L>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: I) -> Self::Output

Performs the << operation. Read more
Source§

impl<'a, T, U, S: Shape, L: Layout, I: Apply<U>> Shr<I> for &'a View<'_, T, S, L>
where &'a T: Shr<I::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<&'a View<'_, T, S, L>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: I) -> Self::Output

Performs the >> operation. Read more
Source§

impl<'a, T, U, S: Shape, L: Layout, I: Apply<U>> Shr<I> for View<'a, T, S, L>
where &'a T: Shr<I::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<View<'a, T, S, L>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: I) -> Self::Output

Performs the >> operation. Read more
Source§

impl<'a, T, U, S: Shape, L: Layout, I: Apply<U>> Sub<I> for &'a View<'_, T, S, L>
where &'a T: Sub<I::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<&'a View<'_, T, S, L>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: I) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a, T, U, S: Shape, L: Layout, I: Apply<U>> Sub<I> for View<'a, T, S, L>
where &'a T: Sub<I::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<View<'a, T, S, L>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: I) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a, T, X: Dim, const A: usize> TryFrom<View<'a, T, (X,)>> for &'a [T; A]

Source§

type Error = View<'a, T, (X,)>

The type returned in the event of a conversion error.
Source§

fn try_from(value: View<'a, T, (X,)>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a, T, X: Dim, Y: Dim, const A: usize, const B: usize> TryFrom<View<'a, T, (X, Y)>> for &'a [[T; B]; A]

Source§

type Error = View<'a, T, (X, Y)>

The type returned in the event of a conversion error.
Source§

fn try_from(value: View<'a, T, (X, Y)>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a, T, X: Dim, Y: Dim, Z: Dim, const A: usize, const B: usize, const C: usize> TryFrom<View<'a, T, (X, Y, Z)>> for &'a [[[T; C]; B]; A]

Source§

type Error = View<'a, T, (X, Y, Z)>

The type returned in the event of a conversion error.
Source§

fn try_from(value: View<'a, T, (X, Y, Z)>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a, T, X: Dim, Y: Dim, Z: Dim, W: Dim, const A: usize, const B: usize, const C: usize, const D: usize> TryFrom<View<'a, T, (X, Y, Z, W)>> for &'a [[[[T; D]; C]; B]; A]

Source§

type Error = View<'a, T, (X, Y, Z, W)>

The type returned in the event of a conversion error.
Source§

fn try_from(value: View<'a, T, (X, Y, Z, W)>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a, T, X: Dim, Y: Dim, Z: Dim, W: Dim, U: Dim, const A: usize, const B: usize, const C: usize, const D: usize, const E: usize> TryFrom<View<'a, T, (X, Y, Z, W, U)>> for &'a [[[[[T; E]; D]; C]; B]; A]

Source§

type Error = View<'a, T, (X, Y, Z, W, U)>

The type returned in the event of a conversion error.
Source§

fn try_from(value: View<'a, T, (X, Y, Z, W, U)>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a, T, X: Dim, Y: Dim, Z: Dim, W: Dim, U: Dim, V: Dim, const A: usize, const B: usize, const C: usize, const D: usize, const E: usize, const F: usize> TryFrom<View<'a, T, (X, Y, Z, W, U, V)>> for &'a [[[[[[T; F]; E]; D]; C]; B]; A]

Source§

type Error = View<'a, T, (X, Y, Z, W, U, V)>

The type returned in the event of a conversion error.
Source§

fn try_from(value: View<'a, T, (X, Y, Z, W, U, V)>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<T, S: Shape, L: Layout<Mapping<S>: Copy>> Copy for View<'_, T, S, L>

Source§

impl<T: Eq, S: Shape, L: Layout> Eq for View<'_, T, S, L>

Source§

impl<T: Sync, S: Shape, L: Layout> Send for View<'_, T, S, L>

Source§

impl<T: Sync, S: Shape, L: Layout> Sync for View<'_, T, S, L>

Auto Trait Implementations§

§

impl<'a, T, S, L> Freeze for View<'a, T, S, L>
where <L as Layout>::Mapping<S>: Freeze,

§

impl<'a, T, S, L> RefUnwindSafe for View<'a, T, S, L>
where <L as Layout>::Mapping<S>: RefUnwindSafe, T: RefUnwindSafe,

§

impl<'a, T, S, L> Unpin for View<'a, T, S, L>
where <L as Layout>::Mapping<S>: Unpin,

§

impl<'a, T, S, L> UnwindSafe for View<'a, T, S, L>
where <L as Layout>::Mapping<S>: UnwindSafe, T: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T, E> Apply<T> for E
where E: Expression,

Source§

type Output<F: FnMut(<E as IntoIterator>::Item) -> T> = Map<E, F>

The resulting type after applying a closure.
Source§

type ZippedWith<I: IntoExpression, F: FnMut((<E as IntoIterator>::Item, <I as IntoIterator>::Item)) -> T> = Map<Zip<E, <I as IntoExpression>::IntoExpr>, F>

The resulting type after zipping elements and applying a closure.
Source§

fn apply<F>(self, f: F) -> <E as Apply<T>>::Output<F>
where F: FnMut(<E as IntoIterator>::Item) -> T,

Returns the array or an expression with the given closure applied to each element.
Source§

fn zip_with<I, F>(self, expr: I, f: F) -> <E as Apply<T>>::ZippedWith<I, F>
where I: IntoExpression, F: FnMut((<E as IntoIterator>::Item, <I as IntoIterator>::Item)) -> T,

Returns the array or an expression with the given closure applied to zipped element pairs.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoCloned<T> for T

Source§

fn clone_to(self, target: &mut T)

Moves an existing object or clones from a reference to the target object.
Source§

fn into_cloned(self) -> T

Returns an existing object or a new clone from a reference.
Source§

impl<E> IntoExpression for E
where E: Expression,

Source§

type Shape = <E as Expression>::Shape

Array shape type.
Source§

type IntoExpr = E

Which kind of expression are we turning this into?
Source§

fn into_expr(self) -> E

Creates an expression from a value.
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.