Trait orx_closure::FunResRef
source · pub trait FunResRef<In, Out: ?Sized, Error> {
// Required method
fn call(&self, input: In) -> Result<&Out, Error>;
}Expand description
Function trait representing In -> Result<&Out, Error> transformation.
It provides the common interface for closures, such as ClosureResRef<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 FunOptRef<In, Out> trait object.
Relation with Fn
FunResRef<In, Out, Error> can be considered equivalent to Fn(In) -> Result<&Out, Error>.
However, it appears to be impossible to have an instance of the latter due to lifetime errors.
Therefore, FunResRef<In, Out, Error> is required.