Trait frunk::hlist::HFoldRightable

source ·
pub trait HFoldRightable<Folder, Init> {
    type Output;

    // Required method
    fn foldr(self, folder: Folder, i: Init) -> Self::Output;
}
Expand description

Trait for performing a right fold over an HList

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

You only need to import this trait when working with generic HLists or Folders of unknown type. If the type of everything is known, then list.foldr(f, init) should “just work” even without the trait.

Required Associated Types§

Required Methods§

source

fn foldr(self, folder: Folder, i: Init) -> Self::Output

Perform a right fold over 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<F, FolderHeadR, FolderTail, H, Tail, Init> HFoldRightable<HCons<F, FolderTail>, Init> for HCons<H, Tail>
where Tail: HFoldRightable<FolderTail, Init>, F: FnOnce(<Tail as HFoldRightable<FolderTail, Init>>::Output, H) -> FolderHeadR,

source§

type Output = FolderHeadR

source§

impl<F, Init> HFoldRightable<F, Init> for HNil

source§

type Output = Init

source§

impl<F, R, H, Tail, Init> HFoldRightable<F, Init> for HCons<H, Tail>
where Tail: HFoldRightableOwned<F, Init>, F: Fn(<Tail as HFoldRightable<F, Init>>::Output, H) -> R,

source§

impl<P, R, H, Tail, Init> HFoldRightable<Poly<P>, Init> for HCons<H, Tail>
where Tail: HFoldRightable<Poly<P>, Init>, P: Func<(<Tail as HFoldRightable<Poly<P>, Init>>::Output, H), Output = R>,