Trait Apply

Source
pub trait Apply<T>: IntoExpression {
    type Output<F: FnMut(Self::Item) -> T>: IntoExpression<Item = T, Shape = Self::Shape>;
    type ZippedWith<I: IntoExpression, F>: IntoExpression<Item = T>
       where F: FnMut((Self::Item, I::Item)) -> T;

    // Required methods
    fn apply<F: FnMut(Self::Item) -> T>(self, f: F) -> Self::Output<F>;
    fn zip_with<I: IntoExpression, F>(
        self,
        expr: I,
        f: F,
    ) -> Self::ZippedWith<I, F>
       where F: FnMut((Self::Item, I::Item)) -> T;
}
Expand description

Trait for applying a closure and returning an existing array or an expression.

Required Associated Types§

Source

type Output<F: FnMut(Self::Item) -> T>: IntoExpression<Item = T, Shape = Self::Shape>

The resulting type after applying a closure.

Source

type ZippedWith<I: IntoExpression, F>: IntoExpression<Item = T> where F: FnMut((Self::Item, I::Item)) -> T

The resulting type after zipping elements and applying a closure.

Required Methods§

Source

fn apply<F: FnMut(Self::Item) -> T>(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((Self::Item, I::Item)) -> T,

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

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, T, U, S: ConstShape> Apply<U> for &'a Array<T, S>

Source§

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

Source§

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

Source§

impl<'a, T, U, S: ConstShape> Apply<U> for &'a mut Array<T, S>

Source§

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

Source§

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

Source§

impl<'a, T, U, S: Shape, A: Allocator> Apply<U> for &'a Tensor<T, S, A>

Source§

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

Source§

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

Source§

impl<'a, T, U, S: Shape, A: Allocator> Apply<U> for &'a mut Tensor<T, S, A>

Source§

type Output<F: FnMut(&'a mut T) -> U> = Map<<&'a mut Tensor<T, S, A> as IntoExpression>::IntoExpr, F>

Source§

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

Source§

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

Source§

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

Source§

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

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>

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>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl<T, S: Shape, A: Allocator> Apply<T> for Tensor<T, S, A>

Source§

type Output<F: FnMut(T) -> T> = Tensor<T, S, A>

Source§

type ZippedWith<I: IntoExpression, F: FnMut((T, I::Item)) -> T> = Tensor<T, S, A>

Source§

impl<T, U, S: ConstShape> Apply<U> for Array<T, S>

Source§

type Output<F: FnMut(T) -> U> = Array<U, S>

Source§

type ZippedWith<I: IntoExpression, F: FnMut((T, I::Item)) -> U> = Array<U, S>