run-on-drop 1.0.0

Run code when an object is dropped
Documentation
  • Coverage
  • 100%
    4 out of 4 items documented1 out of 3 items with examples
  • Size
  • Source code size: 6.93 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 323.99 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • mahkoh/run-on-drop
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • mahkoh

run-on-drop

crates.io docs.rs MSRV

This crate provides a closure wrapper that will run the closure when it is dropped.

Example

use run_on_drop::on_drop;

let object = create_object();
let cleanup = on_drop(|| destroy_object(&object));
initialize_object(&object); // might unwind
cleanup.forget();
return object;

MSRV

The MSRV is max(stable - 3).

License

This project is licensed under either of

  • Apache License, Version 2.0
  • MIT License

at your option.