[−][src]Macro recur_fn::as_recur_fn
Constructs a zero-cost RecurFn
implementation that doesn't capture.
You can consider it as a function definition,
except fn
keyword is replaced by this macro.
So it's recommended to first write function definition and then change it into this macro, so that the IDE's features can work while you're coding the function's body.
Examples
use recur_fn::{as_recur_fn, RecurFn}; let fact = as_recur_fn!(fact(n: u64) -> u64 { if n == 0 { 1 } else { n * fact(n - 1) } }); assert_eq!(6, fact.call(3)); assert_eq!(0, fact.body(|_| 0, 3));