mirror of
https://github.com/eyre-rs/eyre.git
synced 2025-09-29 05:52:13 +00:00

* Propogate context when wrapping errors with Option::take * fix test failure in fmt output * bump version for release
23 lines
631 B
Rust
23 lines
631 B
Rust
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))
|
|
}
|
|
}
|