Trait wyz::pipe::PipeBorrow  
        source ·
        [−]pub trait PipeBorrow {
    fn pipe_borrow<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
    where
        Self: Borrow<T>,
        T: 'a,
        R: 'a + Sized,
    { ... }
    fn pipe_borrow_mut<'a, T, R>(
        &'a mut self, 
        func: impl FnOnce(&'a mut T) -> R
    ) -> R
    where
        Self: BorrowMut<T>,
        T: 'a,
        R: 'a + Sized,
    { ... }
}Expand description
Calls the Borrow or BorrowMut traits before piping.
Provided methods
Pipes a trait borrow into a function that cannot normally be called in suffix position.
Parameters
&self: A borrow of the receiver. By automatically borrowing, this pipe call ensures that the lifetime of the origin object is not artificially truncated.func: A function which receives a trait-directed borrow of the receiver’s value type. Before this function is called,<Self as Borrow<T>::borrow>is called on theselfreference, and the output of that trait borrow is passed tofunc.
Type Parameters
T: The type to whichselfBorrows. This is required to be defined as a method type parameter so that you can disambiguate at call time.R: The return type offunc.
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: A mutable borrow of the receiver. By automatically borrowing, this pipe call ensures that the lifetime of the origin object is not artificially truncated.func: A function which receives a trait-directed borrow of the receiver’s value type. Before this function is called,<Self as BorrowMut<T>::borrow_mut>is called on theselfreference, and the output of that trait borrow is passed tofunc.
Type Parameters
T: The type to whichselfborrows. This is required to be defined as a method type parameter so that you can disambiguate at call time.R: The return type offunc.
Lifetimes
'a: The lifetime of theselfvalue..pipe_mutborrowsselffor the duration'a, and extends it through the return value offunc.
