pub trait CoprodInjector<InjectType, Index> {
    // Required method
    fn inject(to_insert: InjectType) -> Self;
Expand description

Trait for instantiating a coproduct from an element

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

You only need to import this trait when working with generic Coproducts of unknown type. In most code, Coproduct::inject will “just work,” with or without this trait.

Required Methods§


fn inject(to_insert: InjectType) -> Self

Instantiate a coproduct from an element.

Please see the inherent static 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<Head, I, Tail, TailIndex> CoprodInjector<I, There<TailIndex>> for Coproduct<Head, Tail>
where Tail: CoprodInjector<I, TailIndex>,


impl<I, Tail> CoprodInjector<I, Here> for Coproduct<I, Tail>