arcnmx / serde-value

Serialization value trees
http://arcnmx.github.io/serde-value/serde_value/
MIT License
43 stars 30 forks source link

Enum variants are not distinguishable #18

Open qzed opened 6 years ago

qzed commented 6 years ago

If I understand serde correctly, the serialize_<...>_variant functions should emit an externally tagged enum, i.e. some sort of map "variant" => <content> (or simply "variant" in case of a unit-variant). Currently the serializer does not store any information on the enum variant (e.g. in serialize_unit_variant), which effectively transforms this into an untagged enum. Thus multiple variants (e.g. of unit-type) are not distinguishable.

arcnmx commented 4 years ago

This was addressed by #26 but I'm concerned it may be a bit of a lossy conversion, so I'll leave this open for now pending feedback.

qzed commented 4 years ago

Thanks for the update! Haven't tested it yet, but as far as I can tell, this should work. It's pretty much the same as serializing to something like json, so I don't think there should be any issues with regards to lossy conversion.