[go: up one dir, main page]

eyre 0.3.7

Flexible concrete Error Handling and Reporting type built on std::error::Error
Documentation
use crate::error::ErrorImpl;
use crate::EyreContext;
use core::fmt;

impl<C> ErrorImpl<(), C>
where
    C: EyreContext,
{
    pub(crate) fn display(&self, f: &mut fmt::Formatter) -> fmt::Result {
        self.context
            .as_ref()
            .map(|context| context.display(self.error(), f))
            .unwrap_or_else(|| std::fmt::Display::fmt(self.error(), f))
    }

    pub(crate) fn debug(&self, f: &mut fmt::Formatter) -> fmt::Result {
        self.context
            .as_ref()
            .map(|context| context.debug(self.error(), f))
            .unwrap_or_else(|| std::fmt::Debug::fmt(self.error(), f))
    }
}