Trait frunk::hlist::HMappable

source ·
pub trait HMappable<Mapper> {
    type Output;

    // Required method
    fn map(self, mapper: Mapper) -> Self::Output;
}
Expand description

Trait for mapping over an HList

This trait is part of the implementation of the inherent method HCons::map. Please see that method for more information.

You only need to import this trait when working with generic HLists or Mappers of unknown type. If the type of everything is known, then list.map(f) should “just work” even without the trait.

Required Associated Types§

Required Methods§

source

fn map(self, mapper: Mapper) -> Self::Output

Apply a function to each element of an HList.

Please see the inherent method for more information.

The only difference between that inherent method and this trait method is the location of the type parameters. (here, they are on the trait rather than the method)

Implementors§

source§

impl<F> HMappable<F> for HNil

§

type Output = HNil

source§

impl<F, R, H, Tail> HMappable<F> for HCons<H, Tail>where F: Fn(H) -> R, Tail: HMappable<F>,

§

type Output = HCons<R, <Tail as HMappable<F>>::Output>

source§

impl<F, R, MapperTail, H, Tail> HMappable<HCons<F, MapperTail>> for HCons<H, Tail>where F: FnOnce(H) -> R, Tail: HMappable<MapperTail>,

§

type Output = HCons<R, <Tail as HMappable<MapperTail>>::Output>

source§

impl<P, H, Tail> HMappable<Poly<P>> for HCons<H, Tail>where P: Func<H>, Tail: HMappable<Poly<P>>,

§

type Output = HCons<<P as Func<H>>::Output, <Tail as HMappable<Poly<P>>>::Output>