1 #[derive(Debug, PartialEq, Eq)] 2 pub struct LabelError(pub String); 3 4 impl std::fmt::Display for LabelError { fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result5 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { 6 write!(f, "{}", self.0) 7 } 8 } 9 10 impl std::error::Error for LabelError { description(&self) -> &str11 fn description(&self) -> &str { 12 &self.0 13 } 14 } 15 16 impl From<String> for LabelError { from(msg: String) -> Self17 fn from(msg: String) -> Self { 18 Self(msg) 19 } 20 } 21