Function panic_control::disable_hook_in_current_thread [] [src]

pub fn disable_hook_in_current_thread()

Disables the panic hook for the current thread.

The process-global panic hook, either installed with std::panic::set_hook() or the standard library default, gets augmented with a filter that disables invocation of the hook closure if the thread that is calling this function panics.

This function does not allocate resources when called repeatedly in the same thread, and it can be used in any order together with other functions and methods of this crate that modify the panic hook.

Caveats

Note that the suppression can apply to the default panic hook that is normally used to report assertion failures and other unexpected panics on the standard error stream.

Other code within the program that modifies the panic hook, concurrently to, or after, a call to this function, may cause the hook chain to stop working as intended. This function interoperates in a predictable way only with the other functions and methods of this crate that modify the panic hook. Libraries other than those designed for test purposes should avoid using this function.