From 1afe6d0a9b8aeae44b6c6b9604d1e21940dada4f Mon Sep 17 00:00:00 2001 From: RedPhoenixQ Date: Sat, 28 Sep 2024 23:29:51 +0200 Subject: [PATCH] Add ioError to DeError This handles Writer now returning `std::io::Error` --- src/errors.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/errors.rs b/src/errors.rs index 0c5c46e3..53e0e21f 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -318,6 +318,8 @@ pub mod serialize { pub enum DeError { /// Serde custom error Custom(String), + /// IO error from Writer + Io(Arc), /// Xml parsing error InvalidXml(Error), /// Cannot parse to integer @@ -368,6 +370,7 @@ pub mod serialize { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { DeError::Custom(s) => write!(f, "{}", s), + DeError::Io(e) => write!(f, "{}", e), DeError::InvalidXml(e) => write!(f, "{}", e), DeError::InvalidInt(e) => write!(f, "{}", e), DeError::InvalidFloat(e) => write!(f, "{}", e), @@ -409,6 +412,13 @@ pub mod serialize { } } + impl From for DeError { + #[inline] + fn from(e: IoError) -> Self { + Self::Io(Arc::new(e)) + } + } + impl From for DeError { #[inline] fn from(e: Error) -> Self {