Crate hushed_panic

Crate hushed_panic 

Source
Expand description

A crate for hushing panics for a specific thread.

This is especially useful for when you want to hush tests which are intended to panic, but do not want to see the long output.

Usage in a test:

fn my_test() {
    let _x = hushed_panic::hush_this_test();
    panic!(); // Won't print anything!
    drop(_x);
    panic!(); // Would print normally!
}

Structs§

HushGuard
When this struct is dropped, the current thread’s panic is unhushed.

Functions§

hush_panic
Hushes panics for this thread.
hush_this_test
Returns a guard which will call unhush_panic after it is dropped.
unhush_panic
Un-hushes panics on this thread.