pub type Result = std::result::Result; #[derive(Debug)] pub enum GeoffreyDBError { SledError(sled::Error), SerdeJsonError(serde_json::Error), } impl std::error::Error for GeoffreyDBError {} impl std::fmt::Display for GeoffreyDBError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { GeoffreyDBError::SledError(e) => write!(f, "Sled Error: {}", e), GeoffreyDBError::SerdeJsonError(e) => write!(f, "Serde JSON Error: {}", e) } } } impl From for GeoffreyDBError { fn from(e: sled::Error) -> Self { GeoffreyDBError::SledError(e) } } impl From for GeoffreyDBError { fn from(e: serde_json::Error) -> Self { GeoffreyDBError::SerdeJsonError(e) } }