xml
xml copied to clipboard
enum deserialization
not as easy as i expected.
initial implementation at https://github.com/serde-rs/xml/blob/master/src/de/mod.rs#L302-343
messy with tuple like enums since arrays of those are totally weird in xml.
@oli-obk Could you elaborate a bit more on how they're weird?
E.g. I have following snippet:
<action id="1" name="IsMatchingQuote" line="8" col="28"><text> </text><char></char><text> == state->quote </text></action>
And I want Action(Vec<ActionBodyItem>) to parse each element as enum variant (ActionBodyItem::Text(" "), ActionBodyItem::Char, ActionBodyItem::Text(" == state->quote ")). This seems to be quite straightforward, but perhaps I'm missing some edge cases.
@RReverser I'm not sure right now. I need to update to serde 0.9 and see if I can simplify the code. It's probably overly complex.
@oli-obk Yeah, that's another issue I've got hit with, but downgraded my code to be compatible with 0.8 for now, and then found out that enums don't work.
@oli-obk So, as said in another thread, implemented this in serde-xml-rs as it was easier than to migrate existing code to Serde 0.9 and then add missing features. Please let me know if you would like to merge efforts or something.