Trait frunk_core::coproduct::CoproductTaker

source ·
pub trait CoproductTaker<S, I> {
    // Required method
    fn take(self) -> Option<S>;
}
Expand description

Trait for retrieving a coproduct element by type

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

You only need to import this trait when working with generic Coproducts of unknown type. If you have a Coproduct of known type, then co.take() should “just work” even without the trait.

Required Methods§

source

fn take(self) -> Option<S>

Retrieve an element from a coproduct by type, ignoring all others.

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<Head, FromTail, Tail, TailIndex> CoproductTaker<FromTail, There<TailIndex>> for Coproduct<Head, Tail>
where Tail: CoproductTaker<FromTail, TailIndex>,

source§

impl<Head, Tail> CoproductTaker<Head, Here> for Coproduct<Head, Tail>