pub trait HFoldRightableOwned<Folder, Init>: HFoldRightable<Folder, Init> {
    // Required method
    fn real_foldr(self, folder: Folder, init: Init) -> (Self::Output, Folder);
}
Expand description

A real foldr for the folder that must be owned to fold.

Due to HList being a recursive struct and not linear array, the only way to fold it is recursive.

However, there are differences in the foldl and foldr traversing the HList:

  1. foldl calls folder(head) and then passes the ownership of the folder to the next recursive call.
  2. foldr passes the ownership of the folder to the next recursive call, and then tries to call folder(head); but the ownership is already gone!

Required Methods§

source

fn real_foldr(self, folder: Folder, init: Init) -> (Self::Output, Folder)

Implementors§

source§

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

source§

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