diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/util.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/util.rs b/src/util.rs index c83d3f3..cbe7c0d 100644 --- a/src/util.rs +++ b/src/util.rs @@ -59,6 +59,12 @@ macro_rules! enum_u8 { } } + impl ::serde::Serialize for $name { + fn serialize<S: ::serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> { + serializer.serialize_u8((*self).into()) + } + } + impl From<$name> for u8 { fn from(val: $name) -> u8 { val as u8 |