Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

enum deserialization #4

Open
oli-obk opened this issue May 26, 2015 · 4 comments
Open

enum deserialization #4

oli-obk opened this issue May 26, 2015 · 4 comments

Comments

@oli-obk
Copy link

oli-obk commented May 26, 2015

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.

@RReverser
Copy link

@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-&gt;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.

@oli-obk
Copy link
Author

oli-obk commented Feb 13, 2017

@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.

@RReverser
Copy link

@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.

@RReverser
Copy link

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants