Allow bytes for adjantly tagged enums

This commit is contained in:
Max Froehlich committed 2023-02-18 12:49:23 -08:00
1 parent f85c4f2fa9
commit a803ec1c1f
2 files changed
+66

No files matched your search

+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