Trait wyz::pipe::PipeAsRef [−][src]
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,
{ ... }
}Expand description
Calls the AsRef or AsMut traits before piping.
Provided methods
Pipes a trait borrow into a function that cannot normally be called in suffix position.
Parameters
&self: This borrowsselffor the same reasons as described in the other methods.func: A function as described in the other methods. This receives the result ofAsRef::<T>::as_ref.
Lifetimes
'a: The lifetime of theselfvalue..pipe_mutborrowsselffor the duration'a, and extends it through the return value offunc.
Pipes a trait mutable borrow into a function that cannot normally be called in suffix position.
Parameters
&mut self: This borrowsselffor the same reasons as described in the other methods.func: A function as described in the other methods. This receives the result ofAsMut::<T>::as_mut.
Lifetimes
'a: The lifetime of theselfvalue..pipe_mutborrowsselffor the duration'a, and extends it through the return value offunc.