use std::{ fmt::{self, Debug}, io, }; pub type Result = std::result::Result; #[derive(Debug)] pub enum Error { IO(io::Error), ZeroCopyError, } impl From for Error { fn from(value: io::Error) -> Self { Self::IO(value) } } impl From> for Error { fn from(_: zerocopy::error::SizeError) -> Self { Self::ZeroCopyError } } impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { Error::IO(error) => Debug::fmt(&error, f), Error::ZeroCopyError => write!(f, "Zero copy convert error"), } } } impl std::error::Error for Error {}