Trait mdarray::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.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'a, T, B: Buffer> Apply<T> for &'a IntoExpr<B>

§

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

§

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

source§

impl<'a, T, B: Buffer> Apply<T> for &'a mut IntoExpr<B>

§

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

§

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

source§

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

§

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

§

type ZippedWith<I: IntoExpression, F: FnMut((&'a T, I::Item)) -> U> = Map<Zip<<&'a Grid<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 Grid<T, S, A>

§

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

§

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

source§

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

§

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

§

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

source§

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

§

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

§

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

source§

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

§

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

§

type ZippedWith<I: IntoExpression, F: FnMut((&'a T, I::Item)) -> U> = Map<Zip<<&'a Span<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 ExprMut<'_, T, S, L>

§

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

§

type ZippedWith<I: IntoExpression, F: FnMut((&'a mut T, I::Item)) -> U> = Map<Zip<<&'a mut ExprMut<'_, 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 Span<T, S, L>

§

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

§

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

source§

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

§

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

§

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>

§

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

§

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<T, E: Expression> Apply<T> for E

§

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

§

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

source§

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

§

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

§

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

source§

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

§

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

§

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