Tap3Ref

Trait Tap3Ref 

Source
pub trait Tap3Ref {
    // Provided methods
    fn tap3_with<'x, X: ?Sized + 'x, R, 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) -> &'x Self { ... }
    fn tap3_with_mut<'x, X: ?Sized + 'x, M, F, A1, A2, A3>(
        &'x mut self,
        proj: impl FnOnce(&mut Self) -> &mut X,
        f: F,
    ) -> impl FnOnce(A1, A2, A3) -> &'x mut Self
       where F: Tap3Fn<X, A1, A2, A3, M> { ... }
}
Expand description

Tap-style helpers for calling (first, A1..A3) -> R for side effects.

The tap3_with* methods call f with a (possibly projected) borrow of self, discard R, and return self to enable chaining.

Provided Methods§

Source

fn tap3_with<'x, X: ?Sized + 'x, R, 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) -> &'x Self

Calls f(proj(&self), a1..a3) (immutable view), discards the return value, and returns &self.

Source

fn tap3_with_mut<'x, X: ?Sized + 'x, M, F, A1, A2, A3>( &'x mut self, proj: impl FnOnce(&mut Self) -> &mut X, f: F, ) -> impl FnOnce(A1, A2, A3) -> &'x mut Self
where F: Tap3Fn<X, A1, A2, A3, M>,

Calls f(proj(&mut self), a1..a3) (mutable view), discards the return value, and returns &mut self.

This method accepts both immutable Fn(&X) and mutable Fn(&mut X) functions.

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