[−][src]Trait recur_fn::RecurFn
The trait representing a recursive function.
Instead of recurring directly,
this trait uses an injection parameter for recursion,
as you can see in body
method.
Note that the implementation of this trait may not really recur,
i.e. the body method may not call recur
parameter.
In fact, all implementation of Fn(Arg) -> Output
implements RecurFn<Arg, Output>
.
This trait only supports one argument. If you want to have multiple arguments, use tuple.
Required methods
fn body<F: Fn(Arg) -> Output>(&self, recur: F, arg: Arg) -> Output
The body of the recursive function.
Provided methods
fn call(&self, arg: Arg) -> Output
Calls the recursive function.
Implementors
impl<Arg, Output, F: Fn(Arg) -> Output> RecurFn<Arg, Output> for F
[src]
impl<Arg, Output, F: Fn(Arg) -> Output> RecurFn<Arg, Output> for F
Implement RecurFn<Arg, Output>
for the normal function Fn(Arg) -> Output
.
The implementation calls the function directly, without calling recur
.