This commit is contained in:
nora 2023-02-12 11:11:53 +01:00
parent 478a3c15e1
commit 98eaa92612
6 changed files with 263 additions and 3 deletions

View file

@ -27,6 +27,18 @@ macro_rules! const_group_with_fmt {
}
}
impl std::fmt::Display for $struct_name {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self.0 {
$(
$value => f.write_str(stringify!($name)),
)*
a => write!(f, "{}({a})", $group_name)
}
}
}
impl PartialEq<$ty> for $struct_name {
fn eq(&self, other: &$ty) -> bool {
self.0 == *other