finally-block 0.2.0

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
  • Coverage
  • 0%
    0 out of 3 items documented0 out of 2 items with examples
  • Size
  • Source code size: 5.86 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 118.5 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 7s Average build duration of successful builds.
  • all releases: 7s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • CodeChain-io/rust-finally-block
    4 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • sgkim126 github:codechain-io:codechain

finally-block Build Status License: MIT

Finally block is a block that is executed when it's dropped. It helps a user write the deferred statements that should be executed, even when 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()?;
    }
}