Trait FunctorMut

Source
pub trait FunctorMut<'a, A>
where Self: FunctorSelf<'a, A>, A: 'a,
{ // Required method fn fmap_mut<F>(&mut self, f: F) where F: 'a + Send + FnMut(&mut Self::Inner); }
Expand description

Same as Functor but works on &mut self

This trait is not automatically implemented. If a type doesn’t implement it but implements Functor, you can always use the Functor::fmap_fn_mutref method, which has a default implementation.

§Examples

fn double_inner_i32_in_place<'a, T>(outer: &mut T)
where
    T: FunctorMut<'a, i32>,
{
    outer.fmap_mut(|x| *x *= 2);
}

Required Methods§

Source

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Same as Functor::fmap_fn_mutref but works on &mut self

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<'a, A> FunctorMut<'a, A> for Option<A>
where A: 'a,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Source§

impl<'a, A> FunctorMut<'a, A> for Box<dyn Iterator<Item = A> + 'a>
where A: 'a,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Source§

impl<'a, A> FunctorMut<'a, A> for Box<dyn Iterator<Item = A> + Send + 'a>
where A: 'a,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Source§

impl<'a, A> FunctorMut<'a, A> for Box<dyn Send + FnMut() -> A + 'a>
where A: 'a,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Source§

impl<'a, A> FunctorMut<'a, A> for Box<dyn Send + FnOnce() -> A + 'a>
where A: 'a,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Source§

impl<'a, A> FunctorMut<'a, A> for Box<dyn FnMut() -> A + 'a>
where A: 'a,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Source§

impl<'a, A> FunctorMut<'a, A> for Box<dyn FnOnce() -> A + 'a>
where A: 'a,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Source§

impl<'a, A> FunctorMut<'a, A> for BinaryHeap<A>
where A: 'a + Ord,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Source§

impl<'a, A> FunctorMut<'a, A> for BTreeSet<A>
where A: 'a + Ord,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Source§

impl<'a, A> FunctorMut<'a, A> for LinkedList<A>
where A: 'a,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Source§

impl<'a, A> FunctorMut<'a, A> for VecDeque<A>
where A: 'a,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Source§

impl<'a, A> FunctorMut<'a, A> for Vec<A>
where A: 'a,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Source§

impl<'a, A> FunctorMut<'a, A> for Pin<Box<dyn Future<Output = A> + 'a>>
where A: 'a,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Source§

impl<'a, A> FunctorMut<'a, A> for Pin<Box<dyn Future<Output = A> + Send + 'a>>
where A: 'a,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Source§

impl<'a, A> FunctorMut<'a, A> for HashSet<A>
where A: 'a + Eq + Hash,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Source§

impl<'a, A, E> FunctorMut<'a, A> for Result<A, E>
where A: 'a,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Source§

impl<'a, A, X> FunctorMut<'a, A> for Box<dyn Send + FnMut(X) -> A + 'a>
where A: 'a, X: 'a,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Source§

impl<'a, A, X> FunctorMut<'a, A> for Box<dyn Send + FnOnce(X) -> A + 'a>
where A: 'a, X: 'a,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Source§

impl<'a, A, X> FunctorMut<'a, A> for Box<dyn FnMut(X) -> A + 'a>
where A: 'a, X: 'a,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Source§

impl<'a, A, X> FunctorMut<'a, A> for Box<dyn FnOnce(X) -> A + 'a>
where A: 'a, X: 'a,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Source§

impl<'a, K, A> FunctorMut<'a, A> for BTreeMap<K, A>
where K: Ord, A: 'a,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Source§

impl<'a, K, A> FunctorMut<'a, A> for HashMap<K, A>
where K: Eq + Hash, A: 'a,

Source§

fn fmap_mut<F>(&mut self, f: F)
where F: 'a + Send + FnMut(&mut Self::Inner),

Implementors§