use std::fmt::Display; #[derive(Debug)] pub enum Error { IOError(std::io::Error), TOMLError(toml::de::Error), } impl Display for Error { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Error::IOError(error) => write!(f, "IO Error: {}", error), Error::TOMLError(error) => write!(f, "TOML deserialization error: {}", error), } } } impl std::error::Error for Error {} impl From for Error { fn from(e: std::io::Error) -> Self { Self::IOError(e) } } impl From for Error { fn from(e: toml::de::Error) -> Self { Self::TOMLError(e) } }