Trait Functor

Source
pub trait Functor<T>: HKT<T> {
    // Required method
    fn fmap<F, U>(&self, f: F) -> Self::Cont<U>
       where F: Fn(&T) -> U;
}
Expand description

The Functor trait extends the HKT trait to provide a way to map over its content(s) using a function f that transforms values of type T into values of type U.

Required Methods§

Source

fn fmap<F, U>(&self, f: F) -> Self::Cont<U>
where F: Fn(&T) -> U,

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.

Implementations on Foreign Types§

Source§

impl<T> Functor<T> for Option<T>

Source§

fn fmap<F, U>(&self, f: F) -> <Option<T> as HKT<T>>::Cont<U>
where F: Fn(&T) -> U,

Implementors§