pub trait CoprodUninjector<T, Idx>: CoprodInjector<T, Idx> {
    type Remainder;

    // Required method
    fn uninject(self) -> Result<T, Self::Remainder>;
Expand description

Trait for extracting a value from a coproduct in an exhaustive way.

This trait is part of the implementation of the inherent method Coproduct::uninject. 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.uninject() should “just work” even without the trait.

Required Associated Types§

Required Methods§


fn uninject(self) -> Result<T, Self::Remainder>

Attempt to extract a value from a coproduct (or get the remaining possibilities).

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)

Object Safety§

This trait is not object safe.



impl<Hd, Tl> CoprodUninjector<Hd, Here> for Coproduct<Hd, Tl>


type Remainder = Tl


impl<Hd, Tl, T, N> CoprodUninjector<T, There<N>> for Coproduct<Hd, Tl>
where Tl: CoprodUninjector<T, N>,


type Remainder = Coproduct<Hd, <Tl as CoprodUninjector<T, N>>::Remainder>