[][src]Trait frunk_core::hlist::Sculptor

pub trait Sculptor<Target, Indices> {
    type Remainder;
    fn sculpt(self) -> (Target, Self::Remainder);

Trait for pulling out some subset of an HList, using type inference.

This trait is part of the implementation of the inherent method HCons::sculpt. 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.sculpt() should "just work" even without the trait.

Associated Types

type Remainder

Loading content...

Required methods

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

Consumes the current HList and returns an HList with the requested shape.

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)

Loading content...


impl<Source> Sculptor<HNil, HNil> for Source[src]

Implementation for when the target is an empty HList (HNil)

Index type is HNil because we don't need an index for finding HNil

type Remainder = Source

impl<THead, TTail, SHead, STail, IndexHead, IndexTail> Sculptor<HCons<THead, TTail>, HCons<IndexHead, IndexTail>> for HCons<SHead, STail> where
    HCons<SHead, STail>: Plucker<THead, IndexHead>,
    <HCons<SHead, STail> as Plucker<THead, IndexHead>>::Remainder: Sculptor<TTail, IndexTail>, 

Implementation for when we have a non-empty HCons target

Indices is HCons<IndexHead, IndexTail> here because the compiler is being asked to figure out the Index for Plucking the first item of type THead out of Self and the rest (IndexTail) is for the Plucker's remainder induce.

type Remainder = <<HCons<SHead, STail> as Plucker<THead, IndexHead>>::Remainder as Sculptor<TTail, IndexTail>>::Remainder

Loading content...