[][src]Function recur_fn::direct

pub fn direct<Arg, Output, F: Fn(Arg) -> Output>(
    f: F
) -> impl RecurFn<Arg, Output>

Constructs a non-recursive RecurFn calling f directly.

Examples

use recur_fn::{RecurFn, direct};

let double = direct(|n: u64| n * 2);
assert_eq!(4, double.call(2));
assert_eq!(20, double.body(|_| 0, 10));