Trait frunk::coproduct::CoproductTaker
[−]
[src]
pub trait CoproductTaker<S, I> { fn take(self) -> Option<S>; }
Trait for retrieving a coproduct element by type.
Returns an Option
Example
type I32Bool = Coprod!(i32, f32); let co1: I32Bool = into_coproduct(42f32); let get_from_1a: Option<i32> = co1.take(); let get_from_1b: Option<f32> = co1.take(); assert_eq!(get_from_1a, None); assert_eq!(get_from_1b, Some(42f32));Run
Required Methods
Implementors
impl<Head, Tail> CoproductTaker<Head, Here> for Coproduct<Head, Tail>
impl<Head, FromTail, Tail, TailIndex> CoproductTaker<FromTail, There<TailIndex>> for Coproduct<Head, Tail> where
Tail: CoproductTaker<FromTail, TailIndex>,