Trait frunk::hlist::IntoTuple2

source ·
pub trait IntoTuple2 {
    type HeadType;
    type TailOutput;

    // Required method
    fn into_tuple2(self) -> (Self::HeadType, Self::TailOutput);
Expand description

Trait for transforming an HList into a nested tuple.

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

This operation is not useful in generic contexts, so it is unlikely that you should ever need to import this trait. Do not worry; if you have an HList of known type, then list.into_tuple2() should “just work,” even without the trait.

Required Associated Types§


type HeadType

The 0 element in the output tuple


type TailOutput

The 1 element in the output tuple

Required Methods§


fn into_tuple2(self) -> (Self::HeadType, Self::TailOutput)

Turns an HList into nested Tuple2s, which are less troublesome to pattern match and have a nicer type signature.

Please see the inherent method for more information.



impl<T1, T2> IntoTuple2 for HCons<T1, HCons<T2, HNil>>


type HeadType = T1


type TailOutput = T2


impl<T, Tail> IntoTuple2 for HCons<T, Tail>
where Tail: IntoTuple2,


type HeadType = T


type TailOutput = (<Tail as IntoTuple2>::HeadType, <Tail as IntoTuple2>::TailOutput)