use snafu in core

This commit is contained in:
Pavlo Khrystenko
2024-05-22 18:11:39 +02:00
parent e99d7faf00
commit 63e7fd467f
19 changed files with 268 additions and 121 deletions
+24
View File
@@ -0,0 +1,24 @@
use core::fmt::{self, Debug, Display};
#[derive(Clone, PartialEq, Eq)]
pub struct DisplayError<T>(pub T);
impl<T> Debug for DisplayError<T>
where
T: Debug,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
impl<T> Display for DisplayError<T>
where
T: Display,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
impl<T> snafu::Error for DisplayError<T> where T: Display + Debug {}