Allow bytes for adjantly tagged enums

This commit is contained in:
Max Froehlich
2023-02-18 12:49:23 -08:00
parent f85c4f2fa9
commit a803ec1c1f
2 changed files with 66 additions and 0 deletions
+13
View File
@@ -990,6 +990,19 @@ mod content {
Ok(TagContentOtherField::Other)
}
}
fn visit_bytes<E>(self, field: &[u8]) -> Result<Self::Value, E>
where
E: de::Error,
{
if field == self.tag.as_bytes() {
Ok(TagContentOtherField::Tag)
} else if field == self.content.as_bytes() {
Ok(TagContentOtherField::Content)
} else {
Ok(TagContentOtherField::Other)
}
}
}
/// Not public API