summaryrefslogtreecommitdiffstats
path: root/vendor/eyre/src/fmt.rs
blob: b4e97a3efa6eb41bc2c40a5d7624ad52de0360ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::error::ErrorImpl;
use core::fmt;

impl ErrorImpl<()> {
    pub(crate) fn display(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        self.handler
            .as_ref()
            .map(|handler| handler.display(self.error(), f))
            .unwrap_or_else(|| core::fmt::Display::fmt(self.error(), f))
    }

    pub(crate) fn debug(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        self.handler
            .as_ref()
            .map(|handler| handler.debug(self.error(), f))
            .unwrap_or_else(|| core::fmt::Debug::fmt(self.error(), f))
    }
}