pub trait PipeDeref {
    fn pipe_deref<'a, R>(
        &'a self,
        func: impl FnOnce(&'a <Self as Deref>::Target) -> R
    ) -> R
    where
        Self: Deref,
        R: 'a + Sized
, { ... }
fn pipe_deref_mut<'a, R>(
        &'a mut self,
        func: impl FnOnce(&'a mut <Self as Deref>::Target) -> R
    ) -> R
    where
        Self: DerefMut,
        R: 'a + Sized
, { ... } }
Expand description

Calls the Deref or DerefMut traits before piping.

Provided methods

Pipes a dereference into a function that cannot normally be called in suffix position.

Parameters
  • &self: This borrows self for the same reasons as described in the
  • func: A function as described in the other methods. This receives the result of Deref::deref.
Lifetimes
  • 'a: The lifetime of the self value. .pipe_mut borrows self for the duration 'a, and extends it through the return value of func.

Pipes a mutable dereference into a function that cannot normally be called in suffix position.

Parameters
  • &mut self: This mutably borrows self for the same reasons as described in the other methods.
  • func: A function as described in the other methods. This receives the result of DerefMut::deref.
Lifetimes
  • 'a: The lifetime of the self value. .pipe_mut borrows self for the duration 'a, and extends it through the return value of func.

Implementors