fix(apb): enums implement Display too
This commit is contained in:
parent
9e196b3180
commit
49fdc71dbd
1 changed files with 6 additions and 0 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue