pub trait CoproductMappable<Mapper> {
    type Output;

    fn map(self, f: Mapper) -> Self::Output;
}
Expand description

Trait for mapping over a coproduct’s variants.

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

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

Required Associated Types

Required Methods

Use functions to map each variant of a coproduct.

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

Implementation for mapping a Coproduct using a &hlist!.

Implementation for mapping a Coproduct using a &mut hlist!.

Implementation for mapping a Coproduct using a &poly_fn!.

Implementation for mapping a Coproduct using a &mut poly_fn!.

Base case map impl.

Implementation for mapping a Coproduct using a single function that can handle all variants.

Implementation for mapping a Coproduct using an hlist!.

Implementation for mapping a Coproduct using a poly_fn!.