Files
pezkuwi-subxt/core/src/error_utils.rs
T
Pavlo Khrystenko 63e7fd467f use snafu in core
2024-05-22 18:11:39 +02:00

25 lines
481 B
Rust

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 {}