Pipe5Ref

Trait Pipe5Ref 

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

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

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

Provided Methods§

Source

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

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

Semantics: self.pipe5_with(proj, f)(a1..a5) == f(proj(&self), a1..a5).

Source

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

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

Semantics: self.pipe5_with_mut(proj, f)(a1..a5) == f(proj(&mut self), a1..a5).

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> Pipe5Ref for T