[−][src]Macro recur_fn::recur_fn
Expands a function definition to defining a struct,
implementing RecurFn
for the struct and constructing it.
It can be useful if you want a zero-cost RecurFn
implementation.
The function should have exactly one argument.
impl Trait
s and generics are not supported.
Examples
use recur_fn::{recur_fn, RecurFn}; let fact = recur_fn!(fact(n: i32) -> i32 { if n == 0 { 1 } else { n * fact(n - 1) } }); assert_eq!(6, fact.call(3)); assert_eq!(0, fact.body(|_| 0, 3));