Skip to main content

Functor

Trait Functor 

Source
pub trait Functor<A> {
    type Mapped<B>;

    // Required method
    fn fmap<B, F: Fn(A) -> B>(self, f: F) -> Self::Mapped<B>;
}
Expand description

Rust-level Functor trait.

Required Associated Types§

Source

type Mapped<B>

The mapped-over container type.

Required Methods§

Source

fn fmap<B, F: Fn(A) -> B>(self, f: F) -> Self::Mapped<B>

Apply f to every element.

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.

Implementors§

Source§

impl<A> Functor<A> for OptionFunctor<A>

Source§

impl<A> Functor<A> for VecFunctor<A>

Source§

impl<A, E> Functor<A> for ResultFunctor<A, E>