finally-block 0.1.1

Final block is a block that is executed when it dropped. It helps a user to write the deferred statements that should be executed even some statements return early.
Documentation

finally-block Build Status License: MIT

Final block is a block that is executed when it dropped. It helps a user to write the deferred statements that should be executed even some statements return early.

function f(flag: &AtomicBool) -> Option<()> {
    if some_condition {
        let _f = finally(|| {
            flag.store(true, Ordering::SeqCst);
        });
        some_function(flag)?;
    } else {
        another_function()?;
    }
}