1.10.0[][src]Function af_lib::prelude::af_core::test::prelude::panic::take_hook

pub fn take_hook(
) -> Box<dyn Fn(&PanicInfo<'_>) + 'static + Send + Sync, Global>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Unpin + Future + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;

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

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