1 | use crate::error::ErrorImpl; |
2 | use core::fmt; |
3 | |
4 | impl ErrorImpl<()> { |
5 | pub(crate) fn display(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
6 | self.handler |
7 | .as_ref() |
8 | .map(|handler: &Box| handler.display(self.error(), f)) |
9 | .unwrap_or_else(|| core::fmt::Display::fmt(self.error(), f)) |
10 | } |
11 | |
12 | pub(crate) fn debug(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
13 | self.handler |
14 | .as_ref() |
15 | .map(|handler: &Box| handler.debug(self.error(), f)) |
16 | .unwrap_or_else(|| core::fmt::Debug::fmt(self.error(), f)) |
17 | } |
18 | } |
19 | |