pub trait Functor<A, B>: Lift<A, B> {
// Required method
fn map<F>(self, f: F) -> <Self as Lift<A, B>>::Target1
where F: Fn(A) -> B;
}Expand description
A Functor lets you change the type parameter of a generic type.
A Functor defines a method map on a type F<_>: Functor which converts
an F<A> to F<B> using a function Fn(A) -> B applied to the As inside
it.
You can also use this just to modify the values inside your container value without changing their type, if the mapping function returns a value of the same type. This is called an “endofunctor.”
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.