Trait frunk_core::hlist::Plucker

source ·
pub trait Plucker<Target, Index> {
    type Remainder;

    // Required method
    fn pluck(self) -> (Target, Self::Remainder);
}
Expand description

Trait defining extraction from a given HList

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

You only need to import this trait when working with generic HLists of unknown type. If you have an HList of known type, then list.pluck() should “just work” even without the trait.

Required Associated Types§

source

type Remainder

What is left after you pluck the target from the Self

Required Methods§

source

fn pluck(self) -> (Target, Self::Remainder)

Remove an element by type from an HList.

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

Implementation when the pluck target is in the tail

§

type Remainder = HCons<Head, <Tail as Plucker<FromTail, TailIndex>>::Remainder>

source§

impl<T, Tail> Plucker<T, Here> for HCons<T, Tail>

Implementation when the pluck target is in head

§

type Remainder = Tail