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