Trait Functor

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

Required Methods§

Source

fn fmap<F>(&self, f: F) -> Self::T
where F: Fn(&Self::C) -> 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, U> Functor<U> for Option<T>

Source§

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

Source§

impl<T, U> Functor<U> for Box<T>

Source§

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

Source§

impl<T, U> Functor<U> for Rc<T>

Source§

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

Source§

impl<T, U> Functor<U> for Arc<T>

Source§

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

Source§

impl<T, U> Functor<U> for Vec<T>

Source§

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

Implementors§