fix(apb): enums implement Display too

This commit is contained in:
əlemi 2024-06-06 19:57:20 +02:00
parent 9e196b3180
commit 49fdc71dbd
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -38,6 +38,12 @@ macro_rules! strenum {
$($deep($inner),)* $($deep($inner),)*
} }
impl std::fmt::Display for $enum_name {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", self.as_ref())
}
}
impl AsRef<str> for $enum_name { impl AsRef<str> for $enum_name {
fn as_ref(&self) -> &str { fn as_ref(&self) -> &str {
match self { match self {