pub trait Pipe1Ref {
// Provided methods
fn pipe1_with<'x, X: ?Sized + 'x, R: 'x, A1>(
&'x self,
proj: impl FnOnce(&'x Self) -> &'x X,
f: impl FnOnce(&'x X, A1) -> R,
) -> impl FnOnce(A1) -> R { ... }
fn pipe1_with_mut<'x, X: ?Sized + 'x, R: 'x, A1>(
&'x mut self,
proj: impl FnOnce(&'x mut Self) -> &'x mut X,
f: impl FnOnce(&'x mut X, A1) -> R,
) -> impl FnOnce(A1) -> R { ... }
}Expand description
Pipe-style helpers for partial application of (first, A1..A1) -> R functions.
The pipe1_with* methods fix the first argument to a (possibly projected) borrow of self and return a closure that accepts the remaining 1 arguments.
Provided Methods§
Sourcefn pipe1_with<'x, X: ?Sized + 'x, R: 'x, A1>(
&'x self,
proj: impl FnOnce(&'x Self) -> &'x X,
f: impl FnOnce(&'x X, A1) -> R,
) -> impl FnOnce(A1) -> R
fn pipe1_with<'x, X: ?Sized + 'x, R: 'x, A1>( &'x self, proj: impl FnOnce(&'x Self) -> &'x X, f: impl FnOnce(&'x X, A1) -> R, ) -> impl FnOnce(A1) -> R
Partially applies f by fixing its first argument to proj(&self), returning a closure that takes (A1..A1).
Semantics: self.pipe1_with(proj, f)(a1..a1) == f(proj(&self), a1..a1).
Sourcefn pipe1_with_mut<'x, X: ?Sized + 'x, R: 'x, A1>(
&'x mut self,
proj: impl FnOnce(&'x mut Self) -> &'x mut X,
f: impl FnOnce(&'x mut X, A1) -> R,
) -> impl FnOnce(A1) -> R
fn pipe1_with_mut<'x, X: ?Sized + 'x, R: 'x, A1>( &'x mut self, proj: impl FnOnce(&'x mut Self) -> &'x mut X, f: impl FnOnce(&'x mut X, A1) -> R, ) -> impl FnOnce(A1) -> R
Partially applies f by fixing its first argument to proj(&mut self), returning a closure that takes (A1..A1).
Semantics: self.pipe1_with_mut(proj, f)(a1..a1) == f(proj(&mut self), a1..a1).
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.