pub fn new<'a, F, A, B>(
f: impl 'a + Fn(A) -> B,
) -> <F as Function>::Of<'a, A, B>where
F: Function,Expand description
Creates a new function wrapper.
Free function version that dispatches to the type class’ associated function.
§Type Signature
forall a b. Function f => (a -> b) -> f a b
§Parameters
f: The closure to wrap.
§Returns
The wrapped function.
§Examples
use fp_library::classes::function::new;
use fp_library::brands::RcFnBrand;
let f = new::<RcFnBrand, _, _>(|x: i32| x * 2);
assert_eq!(f(5), 10);