Function servo::panic::take_hook1.10.0[][src]

pub fn take_hook(
) -> Box<dyn Fn(&PanicInfo<'_>) + Send + Sync + 'static, Global>
Notable traits for Box<W, Global>
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
Expand description

Unregisters the current panic hook, returning it.

See also the function set_hook.

If no custom hook is registered, the default hook will be returned.


Panics if called from a panicking thread.


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");