pub fn panic_unset_hook() -> Box<dyn Fn(&PanicHookInfo<'_>) + Send + Sync>
Available on crate feature
std
only.Expand description
std
Unregisters the current panic hook, returns it and registers
the default hook in its place.
Re-exported from std
::panic::
take_hook
→panic_unset_hook
.
Unregisters the current panic hook and returns it, registering the default hook in its place.
See also the function set_hook
.
If the default hook is registered it will be returned, but remain registered.
§Panics
Panics if called from a panicking thread.
§Examples
The following will print “Normal panic”:
ⓘ
use std::panic;
panic::set_hook(Box::new(|_| {
println!("Custom panic hook");
}));
let _ = panic::take_hook();
panic!("Normal panic");