use std::fmt; use serde::{ Serialize, Deserialize }; #[derive(Serialize, Deserialize, Clone)] pub enum UError { Raw(String) } impl UError { pub fn description(&self) -> String { match self { UError::Raw(msg) => msg.clone() } } } impl fmt::Debug for UError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let msg = match self { UError::Raw(msg) => msg }; write!(f, "{}", msg) } }