pub trait Function: Category {
type Output<'a, A: 'a, B: 'a>: Deref<Target = dyn Fn(A) -> B + 'a>;
// Required method
fn new<'a, A: 'a, B: 'a>(
f: impl 'a + Fn(A) -> B,
) -> ApplyFunction<'a, Self, A, B>;
}👎Deprecated since 0.0.21: Use fp_library::v2::classes instead
Expand description
Abstraction for wrappers over closures.
This trait is implemented by “Brand” types (like ArcFnBrand
and RcFnBrand) to provide a way to construct
and type-check wrappers over closures (Arc<dyn Fn...>, Rc<dyn Fn...>,
etc.) in a generic context, allowing library users to choose between
implementations at function call sites.
The lifetime 'a ensures the function doesn’t outlive referenced data,
while generic types A and B represent the input and output types, respectively.
Required Associated Types§
type Output<'a, A: 'a, B: 'a>: Deref<Target = dyn Fn(A) -> B + 'a>
👎Deprecated since 0.0.21: Use fp_library::v2::classes instead
Required Methods§
fn new<'a, A: 'a, B: 'a>( f: impl 'a + Fn(A) -> B, ) -> ApplyFunction<'a, Self, A, B>
👎Deprecated since 0.0.21: Use fp_library::v2::classes instead
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.