Skip to main content

with_finally

Function with_finally 

Source
pub fn with_finally<Ctx, R>(
    ctx: &mut Ctx,
    action: impl FnOnce(&mut Ctx) -> R,
    finally: impl FnOnce(&mut Ctx),
) -> R
Expand description

Performs the given action and then calls finally, returning the action’s result. Useful for restoring states post running of an action.