pub trait Functor: Kind0L1T {
// Required method
fn map<'a, ClonableFnBrand: 'a + ClonableFn, A: 'a, B: 'a>(
f: ApplyFn<'a, ClonableFnBrand, A, B>,
) -> ApplyFn<'a, ClonableFnBrand, Apply0L1T<Self, A>, Apply0L1T<Self, B>>;
}
Expand description
A type class for types that can be mapped over.
A Functor
represents a context or container that allows functions to be applied
to values within that context without altering the structure of the context itself.
§Laws
Functor
instances must satisfy the following laws:
- Identity:
map(identity) = identity
. - Composition:
map(compose(f)(g)) = compose(map(f))(map(g))
.
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.