Trait orx_closure::Fun
source · pub trait Fun<In, Out> {
// Required method
fn call(&self, input: In) -> Out;
}Expand description
Function trait representing In -> Out transformation.
It provides the common interface for closures, such as Closure<Capture, In, Out>, over all capture types.
Furthermore, this trait enables to forget about the capture, or equivalently drop the Capture generic parameter, by using dyn Fun<In, Out> trait object.
Relation with Fn
Fun<In, Out> can be considered equivalent to Fn(In) -> Out.
The reason it co-exists is that it is not possible to implement fn_traits in stable version.
However, all that implements Fn(In) -> Out also auto-implements Fun<In, Out>.