pub fn with_finally<TASK, T, E, FINALLY, FT, FE>(
finally: FINALLY,
task: TASK,
) -> Result<T, E>where
TASK: UnwindSafe + FnOnce() -> Result<T, E>,
FINALLY: UnwindSafe + FnOnce() -> Result<FT, FE>,
E: Display,
FE: Display + Into<E>,Expand description
Perform task. On success, error, or panic, perform finally and return
the original success or error, or continue to panic.
This is resilient to errors and panics in finally too. If task finishes
successfully, errors and panics from finally are propagated. However,
errors and panics from task will be propagated in preference to those
coming out of finally – but they will be logged.