xso: add support for attribute-switched enums

skip-changelog, because enums have been introduced in the same release,
so this is merely an addition to the already changelogged enum feature.
This commit is contained in:
Jonas Schäfer 2025-04-27 11:12:21 +02:00 committed by pep
commit c0262fbafb
5 changed files with 608 additions and 11 deletions

View file

@ -74,6 +74,8 @@ impl StructInner {
transparent,
discard,
deserialize_callback,
attribute,
value,
} = meta;
// These must've been cleared by the caller. Because these being set
@ -85,6 +87,8 @@ impl StructInner {
assert!(deserialize_callback.is_none());
reject_key!(exhaustive flag not on "structs" only on "enums");
reject_key!(attribute not on "structs" only on "enums");
reject_key!(value not on "structs" only on "attribute-switched enum variants");
if let Flag::Present(_) = transparent {
reject_key!(namespace not on "transparent structs");