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

pub fn take_hook() -> Box<dyn Fn(&PanicInfo<'_>) + Sync + Send + 'static>
Notable traits for Box<I, A>
impl<I, A> Iterator for Box<I, A> where
    I: Iterator + ?Sized,
    A: Allocator
type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
    F: Future + Unpin + ?Sized,
    A: Allocator + 'static, 
type Output = <F as Future>::Output;impl<R: Read + ?Sized> Read for Box<R>impl<W: Write + ?Sized> Write for Box<W>
Expand description

注销当前的 panic hook,并将其返回。

另请参见函数 set_hook

如果未注册自定义 hook,则将返回默认的 hook。

Panics

Panics (如果从紧急恐慌线程调用)。

Examples

以下将打印 “Normal panic”:

use std::panic;

panic::set_hook(Box::new(|_| {
    println!("Custom panic hook");
}));

let _ = panic::take_hook();

panic!("Normal panic");
Run