[][src]Trait wyz::pipe::PipeAsRef

pub trait PipeAsRef {
    fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
    where
        Self: AsRef<T>,
        T: 'a,
        R: 'a + Sized
, { ... }
fn pipe_as_mut<'a, T, R>(
        &'a mut self,
        func: impl FnOnce(&'a mut T) -> R
    ) -> R
    where
        Self: AsMut<T>,
        T: 'a,
        R: 'a + Sized
, { ... } }

Calls the AsRef or AsMut traits before piping.

Provided methods

fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
    Self: AsRef<T>,
    T: 'a,
    R: 'a + Sized

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

Parameters

  • &self: This 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 AsRef::<T>::as_ref.

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.

fn pipe_as_mut<'a, T, R>(&'a mut self, func: impl FnOnce(&'a mut T) -> R) -> R where
    Self: AsMut<T>,
    T: 'a,
    R: 'a + Sized

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

Parameters

  • &mut self: This 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 AsMut::<T>::as_mut.

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.
Loading content...

Implementors

impl<T> PipeAsRef for T[src]

Loading content...