respector
An extension to add inspect
method to Option
and Result
types.
This allows doing something with the value contained in a Some
, an Ok
(with inspect
) or an Err
(with inspect_err
) while passing the value on,
which can be useful for introducing side effects in debugging, logging, etc.
Usage
use *;
let some = Some;
assert_eq!; // Prints `Some(10)`.
let ok = Ok::;
assert_eq!; // Prints `Ok(10)`.
let err = Err::;
assert_eq!; // Prints `Err(10)`.