pub trait Functor<F, T>{
type Cont<U>: ?Sized;
type Elem;
// Required method
fn apply(self, f: F) -> Self::Cont<T>;
}๐Deprecated since 0.0.7: The
Functor trait has been renamed to MapTo and MapInto for better clarity.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ยง
type Cont<U>: ?Sized
๐Deprecated since 0.0.7: The
Functor trait has been renamed to MapTo and MapInto for better clarity.type Elem
๐Deprecated since 0.0.7: The
Functor trait has been renamed to MapTo and MapInto for better clarity.Required Methodsยง
fn apply(self, f: F) -> Self::Cont<T>
๐Deprecated since 0.0.7: The
Functor trait has been renamed to MapTo and MapInto for better clarity.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.