tap-rs
tap-rs copied to clipboard
TapOps function that would return Err if colsure returned Err?
Not sure if this makes sense for this crate but I happen to need this.
Current code:
let mut foo: Foo = Foo::new();
foo.do_stuff_that_can_fail()?;
let foo = foo;
Would be nice if I could just write:
let foo: Foo = Foo::new().tap_lift_err(|foo| foo.do_stuff_that_can_fail())?;
So tap_lift_err
would call closure and return Ok(self)
if closure result was Ok
(ignoring the value) or Err
from closure if it returned Err
so it can be handled.
tap_lift_err
is probably not the best name...
What are your thoughts?