Trait fmap::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);
}