pub trait Functor<F, T>{
type Cont<U>: ?Sized;
type Elem;
// Required method
fn apply(self, f: F) -> Self::Cont<T>;
}Expand description
The Functor trait describes an interface for a higher-kinded type that can be mapped
over. The trait is parameterized over a function F and a target type T, allowing for
granular control over the mapping process itself, relying on associated types like
Cont<U> to define the resulting container type after the mapping operation and the
Elem type to specify the type of elements contained within the functor before
the mapping operation is applied. Moreover, the apply method takes ownership of the
functor allowing for distinct implementations for referenced, mutabled, and owned
instances.
Required Associated Types§
Required Methods§
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.