Skip to main content

Module clone_fn

Module clone_fn 

Source
Expand description

Cloneable wrappers over closures for generic handling of functions in higher-kinded contexts.

The CloneFn trait defines the type of the wrapper, parameterized by a ClosureMode that determines whether the wrapped closure takes owned values (Val) or references (Ref).

The LiftFn trait provides construction of Val-mode wrapped functions.

§Examples

use fp_library::{
	brands::*,
	functions::*,
};

let f = lift_fn_new::<RcFnBrand, _, _>(|x: i32| x * 2);
assert_eq!(f(5), 10);

Traits§

CloneFn
A trait for cloneable wrappers over closures, parameterized by closure mode.
LiftFn
A trait for constructing Val-mode cloneable function wrappers from closures.
RefLiftFn
A trait for constructing Ref-mode cloneable function wrappers from closures.

Functions§

new
Creates a new cloneable function wrapper.
ref_new
Creates a new cloneable by-reference function wrapper.