eyre/
fmt.rs

1use crate::{error::ErrorImpl, ptr::RefPtr};
2use core::fmt;
3
4impl ErrorImpl<()> {
5    pub(crate) fn display(this: RefPtr<'_, Self>, f: &mut fmt::Formatter<'_>) -> fmt::Result {
6        ErrorImpl::header(this)
7            .handler
8            .as_ref()
9            .map(|handler| handler.display(Self::error(this), f))
10            .unwrap_or_else(|| core::fmt::Display::fmt(Self::error(this), f))
11    }
12
13    /// Debug formats the error using the captured handler
14    pub(crate) fn debug(this: RefPtr<'_, Self>, f: &mut fmt::Formatter<'_>) -> fmt::Result {
15        ErrorImpl::header(this)
16            .handler
17            .as_ref()
18            .map(|handler| handler.debug(Self::error(this), f))
19            .unwrap_or_else(|| core::fmt::Debug::fmt(Self::error(this), f))
20    }
21}