pub trait TapResult<T: Sized, E: Sized>: Sized {
    fn tap_ok<F: FnOnce(&T) -> R, R>(self, func: F) -> Self;
fn tap_ok_mut<F: FnOnce(&mut T) -> R, R>(self, func: F) -> Self;
fn tap_err<F: FnOnce(&E) -> R, R>(self, func: F) -> Self;
fn tap_err_mut<F: FnOnce(&mut E) -> R, R>(self, func: F) -> Self; fn tap_ok_dbg<F: FnOnce(&T) -> R, R>(self, func: F) -> Self { ... }
fn tap_ok_mut_dbg<F: FnOnce(&mut T) -> R, R>(self, func: F) -> Self { ... }
fn tap_err_dbg<F: FnOnce(&E) -> R, R>(self, func: F) -> Self { ... }
fn tap_err_mut_dbg<F: FnOnce(&mut E) -> R, R>(self, func: F) -> Self { ... } }
Expand description

Result Tap

This trait allows conditional tapping of Result wrappers. The methods only invoke their provided function, on the inner type, if the Result has the correct outer variant.

Note that the result value of whichever function you pass to the tapper is discarded, so if that function returns a Result, an “unused must use” warning will be raised! You must explicitly handle or drop a Result value if your tapper’s function produces one.

Required methods

Provides the inner value for inspection if the Result is Ok.

Provides the inner value for modification if the Result is Ok.

Provides the inner error value for inspection if the Result is Err.

Provides the inner error value for modification if the Result is Err.

Provided methods

Calls tap_ok in debug builds, and does nothing in release builds.

Calls tap_ok_mut in debug builds, and does nothing in release builds.

Calls tap_err in debug builds, and does nothing in release builds.

Calls tap_err_mut in debug builds, and does nothing in release builds.

Implementations on Foreign Types

Implementors