use thiserror::Error; #[derive(Debug, Error)] pub enum CodecError { #[error("io error: {0}")] IoError(#[from] std::io::Error), #[error("{0}")] Custom(String), } pub type Result = core::result::Result; impl From<&str> for CodecError { fn from(value: &str) -> Self { Self::Custom(value.to_string()) } } impl From for CodecError { fn from(value: String) -> Self { Self::Custom(value) } }