Skip to main content

MapTo

Trait MapTo 

Source
pub trait MapTo<F, U>
where F: FnOnce(Self::Elem) -> U,
{ type Cont<_T>; type Elem; // Required method fn mapt(&self, f: F) -> Self::Cont<U>; }
Expand description

MapTo establishes an interface for containers capable of applying a given function onto each of their elements, by reference.

Required Associated Types§

Source

type Cont<_T>

Source

type Elem

Required Methods§

Source

fn mapt(&self, f: F) -> Self::Cont<U>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a, U, V, F> MapTo<F, V> for Option<&'a U>
where F: for<'b> FnOnce(&'b U) -> V,

Source§

type Cont<W> = Option<W>

Source§

type Elem = &'a U

Source§

fn mapt(&self, f: F) -> <Option<&'a U> as MapTo<F, V>>::Cont<V>

Source§

impl<A, B, S, D, F> MapTo<F, B> for ArrayBase<S, D, A>
where A: Clone, D: Dimension, S: Data<Elem = A>, F: Fn(A) -> B,

Source§

type Cont<V> = ArrayBase<OwnedRepr<V>, D>

Source§

type Elem = A

Source§

fn mapt(&self, f: F) -> <ArrayBase<S, D, A> as MapTo<F, B>>::Cont<B>

Implementors§

Source§

impl<A, B, S, D, F> MapTo<F, B> for ParamsBase<S, D, A>
where A: Clone, D: Dimension, S: Data<Elem = A>, F: Fn(A) -> B,

Source§

type Cont<V> = ParamsBase<OwnedRepr<V>, D, V>

Source§

type Elem = A