[−][src]Crate maybe_unwind
A wrapper of catch_unwind
that also captures the panic information.
The main purpose of this library is to provide a utility for capturing the error information from assetion macros in custom test libraries.
Example
use maybe_unwind::maybe_unwind; maybe_unwind::set_hook(); if let Err(unwind) = maybe_unwind(|| do_something()) { eprintln!("payload = {:?}", unwind.payload()); eprintln!("location = {:?}", unwind.location()); }
Structs
Location | The information about the location of an unwinding panic. |
MaybeUnwind | A future for the |
Unwind | The captured information about an unwinding panic. |
Traits
FutureMaybeUnwindExt | An extension trait for |
Functions
maybe_unwind | Invokes a closure, capturing the cause of an unwinding panic if one occurs. |
reset_hook | Unregisters the custom panic hook and reset the previous hook. |
set_hook | Registers the custom panic hook so that the panic information can be captured. |