[−][src]Trait recur_fn::RecurFn
The recursive function trait.
Instead of recurring directly,
this trait allows user to customize the recursion
by accepting Fn
-type parameter.
In this way, we can extract and extend the body of the recursive function.
This trait only supports one argument. If you need multiple arguments, use tuple.
Required methods
fn body(
&self,
recur: impl Fn(Arg) -> Output,
arg: Arg
) -> Output
&self,
recur: impl Fn(Arg) -> Output,
arg: Arg
) -> Output
The body of the recursive function.
Performance tip: mark this method #[inline]
to make the
call
method as fast as recurring directly.
Provided methods
fn call(&self, arg: Arg) -> Output
Calls the recursive function.
Implementors
impl<Arg, Output, D: Deref> RecurFn<Arg, Output> for D where
D::Target: DynRecurFn<Arg, Output>,
[src]
D::Target: DynRecurFn<Arg, Output>,