diff --git a/src/io/core.rs b/src/io/core.rs index f6cb80e..f83f5cf 100644 --- a/src/io/core.rs +++ b/src/io/core.rs @@ -8,36 +8,26 @@ pub enum ErrorKind { Other, } -pub struct Error { - repr: Box, -} - -trait ErrorRepr: Display + Debug {} -impl ErrorRepr for T {} +pub struct Error(&'static str); impl Display for Error { fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { - Display::fmt(self.repr.as_ref(), formatter) + Display::fmt(self.0, formatter) } } impl Debug for Error { fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { - Debug::fmt(self.repr.as_ref(), formatter) + Debug::fmt(self.0, formatter) } } impl serde::de::StdError for Error {} impl Error { - pub(crate) fn new(kind: ErrorKind, error: E) -> Error - where - E: Display + Debug + Send + Sync + 'static, - { + pub(crate) fn new(kind: ErrorKind, error: &'static str) -> Error { let _ = kind; - Error { - repr: Box::new(error), - } + Error(error) } }