xref: /aosp_15_r20/external/bazelbuild-rules_rust/util/label/label_error.rs (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
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