pub struct DefaultHandler { /* private fields */ }
Expand description
The default provided error report handler for eyre::Report
.
On nightly this supports conditionally capturing a std::backtrace::Backtrace
if the source
error did not already capture one.
Implementations§
Source§impl DefaultHandler
impl DefaultHandler
Sourcepub fn default_with(error: &(dyn StdError + 'static)) -> Box<dyn EyreHandler>
pub fn default_with(error: &(dyn StdError + 'static)) -> Box<dyn EyreHandler>
Manual hook which constructs DefaultHandler
s.
§Details
When supplied to the set_hook
function, default_with
will cause eyre::Report
to use
DefaultHandler
as the error report handler.
If the auto-install
feature is enabled, and a user-provided hook for constructing
EyreHandlers
was not installed using set_hook
, DefaultHandler::default_with
is automatically installed as the hook.
§Example
ⓘ
use eyre::{DefaultHandler, eyre, InstallError, Result, set_hook};
fn main() -> Result<()> {
install_default().expect("default handler inexplicably already installed");
Err(eyre!("hello from default error city!"))
}
fn install_default() -> Result<(), InstallError> {
set_hook(Box::new(DefaultHandler::default_with))
}
Trait Implementations§
Source§impl Debug for DefaultHandler
impl Debug for DefaultHandler
Source§impl EyreHandler for DefaultHandler
impl EyreHandler for DefaultHandler
Auto Trait Implementations§
impl Freeze for DefaultHandler
impl RefUnwindSafe for DefaultHandler
impl Send for DefaultHandler
impl Sync for DefaultHandler
impl Unpin for DefaultHandler
impl UnwindSafe for DefaultHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more