[][src]Function recur_fn::direct

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

Constructs a non-recursive RecurFn calling f directly.

Examples

use recur_fn::{RecurFn, direct};

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