drop-panic

Crates.iodrop-panic
lib.rsdrop-panic
version0.1.0
sourcesrc
created_at2024-03-20 06:33:48.66332
updated_at2024-03-20 06:33:48.66332
descriptionThe callback that will be called if the current thread panics
homepage
repositoryhttps://github.com/bells307/drop-panic
max_upload_size
id1180026
size2,888
(bells307)

documentation

README

drop-panic

The callback that will be called if the current thread panics.

Example

let panicked = Arc::new(AtomicBool::new(false));

let jh = thread::spawn({
    let panicked = Arc::clone(&panicked);
    move || {
        drop_panic! {
            panicked.store(true, Ordering::Release);
        };

        panic!("boom");
    }
});

assert!(jh.join().is_err());
assert!(panicked.load(Ordering::Acquire));
Commit count: 4

cargo fmt