Function snocat::util::finally_async[][src]

pub async fn finally_async<T, E, FT: Future<Output = Result<T, E>>, FC: Future<Output = Result<(), E>>>(
    cb: impl FnOnce() -> FT,
    cleanup: impl FnOnce(&mut Result<T, E>) -> FC
) -> Result<T, E>
Expand description

Run a block, then, regardless of success/failure, run another block, with access to the results. Exceptions from the first block are preferred, then from the finally block, then successes