Pipe3Ref

Trait Pipe3Ref 

Source
pub trait Pipe3Ref {
    // Provided methods
    fn pipe3_with<'x, X: ?Sized + 'x, R: 'x, A1, A2, A3>(
        &'x self,
        proj: impl FnOnce(&'x Self) -> &'x X,
        f: impl FnOnce(&'x X, A1, A2, A3) -> R,
    ) -> impl FnOnce(A1, A2, A3) -> R { ... }
    fn pipe3_with_mut<'x, X: ?Sized + 'x, R: 'x, A1, A2, A3>(
        &'x mut self,
        proj: impl FnOnce(&'x mut Self) -> &'x mut X,
        f: impl FnOnce(&'x mut X, A1, A2, A3) -> R,
    ) -> impl FnOnce(A1, A2, A3) -> R { ... }
}
Expand description

Pipe-style helpers for partial application of (first, A1..A3) -> R functions.

The pipe3_with* methods fix the first argument to a (possibly projected) borrow of self and return a closure that accepts the remaining 3 arguments.

Provided Methods§

Source

fn pipe3_with<'x, X: ?Sized + 'x, R: 'x, A1, A2, A3>( &'x self, proj: impl FnOnce(&'x Self) -> &'x X, f: impl FnOnce(&'x X, A1, A2, A3) -> R, ) -> impl FnOnce(A1, A2, A3) -> R

Partially applies f by fixing its first argument to proj(&self), returning a closure that takes (A1..A3).

Semantics: self.pipe3_with(proj, f)(a1..a3) == f(proj(&self), a1..a3).

Source

fn pipe3_with_mut<'x, X: ?Sized + 'x, R: 'x, A1, A2, A3>( &'x mut self, proj: impl FnOnce(&'x mut Self) -> &'x mut X, f: impl FnOnce(&'x mut X, A1, A2, A3) -> R, ) -> impl FnOnce(A1, A2, A3) -> R

Partially applies f by fixing its first argument to proj(&mut self), returning a closure that takes (A1..A3).

Semantics: self.pipe3_with_mut(proj, f)(a1..a3) == f(proj(&mut self), a1..a3).

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.

Implementors§

Source§

impl<T: ?Sized> Pipe3Ref for T