pub trait Pipe0Ref {
// Provided methods
fn pipe0_with<'a, X: ?Sized + 'a, R: 'a>(
&'a self,
proj: impl FnOnce(&'a Self) -> &'a X,
f: impl FnOnce(&'a X) -> R,
) -> impl FnOnce() -> R { ... }
fn pipe0_with_mut<'a, X: ?Sized + 'a, R: 'a>(
&'a mut self,
proj: impl FnOnce(&'a mut Self) -> &'a mut X,
f: impl FnOnce(&'a mut X) -> R,
) -> impl FnOnce() -> R { ... }
}Expand description
Borrow-based arity-0 piping.
Fixes the first argument to self (possibly projected) and returns a
nullary closure.
Provided Methods§
Sourcefn pipe0_with<'a, X: ?Sized + 'a, R: 'a>(
&'a self,
proj: impl FnOnce(&'a Self) -> &'a X,
f: impl FnOnce(&'a X) -> R,
) -> impl FnOnce() -> R
fn pipe0_with<'a, X: ?Sized + 'a, R: 'a>( &'a self, proj: impl FnOnce(&'a Self) -> &'a X, f: impl FnOnce(&'a X) -> R, ) -> impl FnOnce() -> R
Partially applies f by fixing its first argument to proj(&self),
returning a nullary closure.
Law: self.pipe0_with(proj, f)() = f(proj(&self)).
Sourcefn pipe0_with_mut<'a, X: ?Sized + 'a, R: 'a>(
&'a mut self,
proj: impl FnOnce(&'a mut Self) -> &'a mut X,
f: impl FnOnce(&'a mut X) -> R,
) -> impl FnOnce() -> R
fn pipe0_with_mut<'a, X: ?Sized + 'a, R: 'a>( &'a mut self, proj: impl FnOnce(&'a mut Self) -> &'a mut X, f: impl FnOnce(&'a mut X) -> R, ) -> impl FnOnce() -> R
Partially applies f by fixing its first argument to proj(&mut self),
returning a nullary closure.
Law: self.pipe0_with_mut(proj, f)() = f(proj(&mut self)).
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.