Trait AndThen

Source
pub trait AndThen<B>: Higher {
    // Required method
    fn and_then<F>(self, f: F) -> Self::Target<B>
       where F: FnMut(Self::Param) -> Self::Target<B>;
}
Expand description

Gives access to the and_then method. This trait is needed to implement ApN. The motivation for not using FlatMap is that there are situations where and_then can be implemented but not FlatMap::flat_map, e.g. Validated.

Required Methods§

Source

fn and_then<F>(self, f: F) -> Self::Target<B>
where F: FnMut(Self::Param) -> Self::Target<B>,

Maps a function over a value in the context and flattens the resulting nested context.

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<A, B> AndThen<B> for PhantomData<A>

Source§

fn and_then<F>(self, _f: F) -> PhantomData<B>
where F: FnMut(A) -> PhantomData<B>,

Source§

impl<A, B, K: Hash + Eq> AndThen<B> for HashMap<K, A>

Source§

fn and_then<F>(self, f: F) -> HashMap<K, B>
where F: FnMut(A) -> HashMap<K, B>,

Source§

impl<B, T> AndThen<B> for Option<T>

Source§

fn and_then<F>(self, f: F) -> Self::Target<B>
where F: FnMut(Self::Param) -> Self::Target<B>,

Source§

impl<B, T> AndThen<B> for Box<T>

Source§

fn and_then<F>(self, f: F) -> Self::Target<B>
where F: FnMut(Self::Param) -> Self::Target<B>,

Source§

impl<B, T> AndThen<B> for LinkedList<T>

Source§

fn and_then<F>(self, f: F) -> Self::Target<B>
where F: FnMut(Self::Param) -> Self::Target<B>,

Source§

impl<B, T> AndThen<B> for VecDeque<T>

Source§

fn and_then<F>(self, f: F) -> Self::Target<B>
where F: FnMut(Self::Param) -> Self::Target<B>,

Source§

impl<B, T> AndThen<B> for Vec<T>

Source§

fn and_then<F>(self, f: F) -> Self::Target<B>
where F: FnMut(Self::Param) -> Self::Target<B>,

Source§

impl<B, T, E> AndThen<B> for Result<T, E>

Source§

fn and_then<F>(self, f: F) -> Self::Target<B>
where F: FnMut(Self::Param) -> Self::Target<B>,

Source§

impl<B: Ord, T> AndThen<B> for BinaryHeap<T>

Source§

fn and_then<F>(self, f: F) -> Self::Target<B>
where F: FnMut(Self::Param) -> Self::Target<B>,

Source§

impl<B: Ord, T> AndThen<B> for BTreeSet<T>

Source§

fn and_then<F>(self, f: F) -> Self::Target<B>
where F: FnMut(Self::Param) -> Self::Target<B>,

Source§

impl<B: Hash + Eq, T> AndThen<B> for HashSet<T>

Source§

fn and_then<F>(self, f: F) -> Self::Target<B>
where F: FnMut(Self::Param) -> Self::Target<B>,

Implementors§

Source§

impl<A, B, E> AndThen<B> for Validated<A, E>

Source§

impl<B, T> AndThen<B> for NEVec<T>