MutableExt

Trait MutableExt 

Source
pub trait MutableExt<A> {
    // Required methods
    fn inspect(&self, f: impl FnOnce(&A));
    fn inspect_mut(&self, f: impl FnOnce(&mut A));
    fn map<B>(&self, f: impl FnOnce(&A) -> B) -> B;
    fn map_mut<B>(&self, f: impl FnOnce(&mut A) -> B) -> B;
    fn apply(&self, f: impl FnOnce(A) -> A)
       where A: Copy;
    fn apply_cloned(&self, f: impl FnOnce(A) -> A)
       where A: Clone;

    // Provided methods
    fn into_inner(self) -> A
       where A: Default,
             Self: Sized { ... }
    fn take(&self) -> A
       where A: Default { ... }
}

Required Methods§

Source

fn inspect(&self, f: impl FnOnce(&A))

Source

fn inspect_mut(&self, f: impl FnOnce(&mut A))

Source

fn map<B>(&self, f: impl FnOnce(&A) -> B) -> B

Source

fn map_mut<B>(&self, f: impl FnOnce(&mut A) -> B) -> B

Source

fn apply(&self, f: impl FnOnce(A) -> A)
where A: Copy,

Source

fn apply_cloned(&self, f: impl FnOnce(A) -> A)
where A: Clone,

Provided Methods§

Source

fn into_inner(self) -> A
where A: Default, Self: Sized,

Source

fn take(&self) -> A
where A: Default,

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> MutableExt<A> for Mutable<A>

Source§

fn inspect(&self, f: impl FnOnce(&A))

Source§

fn inspect_mut(&self, f: impl FnOnce(&mut A))

Source§

fn map<B>(&self, f: impl FnOnce(&A) -> B) -> B

Source§

fn map_mut<B>(&self, f: impl FnOnce(&mut A) -> B) -> B

Source§

fn apply(&self, f: impl FnOnce(A) -> A)
where A: Copy,

Source§

fn apply_cloned(&self, f: impl FnOnce(A) -> A)
where A: Clone,

Implementors§