pub struct ErrorStackHandler<C>(/* private fields */);Available on crate feature
compat-error-stack05 only.Expand description
A custom handler for error_stack::Report that delegates to
error-stack’s own formatting.
This handler ensures that error_stack::Report objects display
identically whether they’re used directly or wrapped in a rootcause
Report. You typically don’t need to use this handler directly - it’s
used automatically by the IntoRootcause trait.
§Implementation Details
- Display: Uses
error_stack::Report’sDisplayimplementation - Debug: Uses
error_stack::Report’sDebugimplementation - Source: Uses the current context’s
sourcemethod to traverse the error chain - Formatting style: Matches the report’s formatting function (Display or Debug)
§Examples
use rootcause::{Report, compat::error_stack05::ErrorStackHandler};
let es_report = error_stack::Report::new(std::io::Error::from(std::io::ErrorKind::NotFound));
let report: Report<_> = Report::new_custom::<ErrorStackHandler<_>>(es_report);§Type Parameters
C: The context type of the error-stack report, which must implementError + Send + Sync + 'static
Trait Implementations§
Source§impl<C> ContextHandler<Report<C>> for ErrorStackHandler<C>where
C: Context + 'static,
impl<C> ContextHandler<Report<C>> for ErrorStackHandler<C>where
C: Context + 'static,
Source§fn source(value: &Report<C>) -> Option<&(dyn Error + 'static)>
fn source(value: &Report<C>) -> Option<&(dyn Error + 'static)>
Returns the underlying error source for this context, if any. Read more
Source§fn display(value: &Report<C>, formatter: &mut Formatter<'_>) -> Result
fn display(value: &Report<C>, formatter: &mut Formatter<'_>) -> Result
Formats the context using display-style formatting. Read more
Source§fn debug(value: &Report<C>, formatter: &mut Formatter<'_>) -> Result
fn debug(value: &Report<C>, formatter: &mut Formatter<'_>) -> Result
Formats the context using debug-style formatting. Read more
Source§fn preferred_formatting_style(
value: &C,
report_formatting_function: FormattingFunction,
) -> ContextFormattingStyle
fn preferred_formatting_style( value: &C, report_formatting_function: FormattingFunction, ) -> ContextFormattingStyle
Specifies the preferred formatting style when this context is embedded
in a report. Read more
Auto Trait Implementations§
impl<C> Freeze for ErrorStackHandler<C>
impl<C> RefUnwindSafe for ErrorStackHandler<C>where
C: RefUnwindSafe,
impl<C> Send for ErrorStackHandler<C>where
C: Send,
impl<C> Sync for ErrorStackHandler<C>where
C: Sync,
impl<C> Unpin for ErrorStackHandler<C>where
C: Unpin,
impl<C> UnwindSafe for ErrorStackHandler<C>where
C: UnwindSafe,
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