Brian Silverman | cc09f18 | 2022-03-09 15:40:20 -0800 | [diff] [blame] | 1 | #[derive(Debug, PartialEq)] |
2 | pub struct LabelError(pub String); | ||||
3 | |||||
4 | impl std::fmt::Display for LabelError { | ||||
5 | 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 { | ||||
11 | fn description(&self) -> &str { | ||||
12 | &self.0 | ||||
13 | } | ||||
14 | } | ||||
15 | |||||
16 | impl From<String> for LabelError { | ||||
17 | fn from(msg: String) -> Self { | ||||
18 | Self(msg) | ||||
19 | } | ||||
20 | } |