1 | use crate::{error::ErrorImpl, ptr::RefPtr}; |
---|---|
2 | use core::fmt; |
3 | |
4 | impl ErrorImpl<()> { |
5 | pub(crate) fn display(this: RefPtr<'_, Self>, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
6 | ErrorImplOption |
7 | .handler |
8 | .as_ref() |
9 | .map(|handler: &Box |
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 | ErrorImplOption |
16 | .handler |
17 | .as_ref() |
18 | .map(|handler: &Box |
19 | .unwrap_or_else(|| core::fmt::Debug::fmt(Self::error(this), f)) |
20 | } |
21 | } |
22 |