I'd like to be able to define an enum that only has unit variants to be serialized/deserialized as a scalar.
For example:
#[xml(scalar)]
enum Foo {
Bar,
Baz,
}
Should serialize as the string Bar. Deserializing any other string should yield an error. Depending on the order with #17, we should also support using rename_all on enums to rename variants. While you're in there, in the case that the variant has an assigned value we should serialize that value:
#[xml(scalar)]
enum Foo {
Bar = 12,
Baz,
}
It should be a compile-time error to have #[xml(scalar)] on an enum that has non-unit variants like Foo(u8) or Bar { n: usize }.
I'd like to be able to define an enum that only has unit variants to be serialized/deserialized as a scalar.
For example:
Should serialize as the string
Bar
. Deserializing any other string should yield an error. Depending on the order with #17, we should also support usingrename_all
on enums to rename variants. While you're in there, in the case that the variant has an assigned value we should serialize that value:It should be a compile-time error to have
#[xml(scalar)]
on an enum that has non-unit variants likeFoo(u8)
orBar { n: usize }
.