Merge pull request #2377 from mfro/master

Allow bytes for adjacently tagged enums
This commit is contained in:
David Tolnay
2023-05-04 18:39:57 -07:00
committed by GitHub
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