Crate fmap

source ·
Expand description

Functors in Rust

The following traits are provided by this module:

  • Functor provides a general fmap method, which is a generalization of Option::map, Result::map, and so on, and which is implemented for a variety of types in the standard library.
  • FunctorSelf is a special case of Functor where types aren’t changed when mapping. It is automatically implemented where applicable but must be added as a bound in certain cases.
  • FunctorMut is a special case of FunctorSelf whose fmap_mut method operates on &mut self. It is not implemented automatically, but this crate provides implementations for all types in the standard library for which Functor is implemented.
  • Contravariant, ContravariantSelf, and ContravariantMut which are the contravariant equivalents of the previous three traits.

Traits