Expand description
This crate gives a generic way to add a callback to any dropping value
You may use this for debugging values, see the struct documentation or the standalone examples.
§Example:
extern crate drop_guard;
use drop_guard::guard;
use std::thread::{spawn, sleep};
use std::time::Duration;
fn main() {
let _ = guard(spawn(move || {
sleep(Duration::from_secs(2));
println!("println! from thread");
})
, |join_handle| join_handle.join().unwrap());
println!("Waiting for thread ...");
}
Structs§
- Drop
Guard - The DropGuard will remain to
Send
andSync
fromT
.