register_panic_hook

Function register_panic_hook 

Source
pub fn register_panic_hook(hook: PanicHook) -> PanicHookGuard
Expand description

Registers a hook to be called when a panic occurs. Panic hooks are called in the order that they are registered. Dropping the returned PanicHookGuard removes the registered hook.

In the case that the panic hook refers to the object that contains the PanicHookGuard, make sure to use std::sync::Weak to avoid leaks. Arc::new_cyclic may be useful in constructing such an object.