Skip to main content

ErrorStackHandler

Struct ErrorStackHandler 

Source
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’s Display implementation
  • Debug: Uses error_stack::Report’s Debug implementation
  • Source: Uses the current context’s source method 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 implement Error + Send + Sync + 'static

Trait Implementations§

Source§

impl<C> ContextHandler<Report<C>> for ErrorStackHandler<C>
where C: Context + 'static,

Source§

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

Formats the context using display-style formatting. Read more
Source§

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

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<O> ObjectMarkerFor<Local> for O
where O: 'static,

Source§

impl<O> ObjectMarkerFor<SendSync> for O
where O: 'static + Send + Sync,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> OpaqueAttachment for T
where T: Send + Sync + 'static,