We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have a use case which involves parsing optionally-empty lists, like so:
<mylist> <item name="foo"></item> <item name="bar"></item> </mylist>
or:
<mylist> </mylist>
What would be the equivalent rust struct to represent this with serde-xml-rs?
The text was updated successfully, but these errors were encountered:
This one is exactly covered in readme:
#[derive(Debug, Deserialize)] struct Project { pub name: String, #[serde(rename = "Item", default)] pub items: Vec<Item> }
Here items maps to optional list of <Item ... /> tags.
items
<Item ... />
TL;DR - always put #[serde(default)] on potentially-missing things.
#[serde(default)]
Sorry, something went wrong.
Oh. My bad, I was missing the #[serde(default)]. Thanks!
No branches or pull requests
I have a use case which involves parsing optionally-empty lists, like so:
or:
What would be the equivalent rust struct to represent this with serde-xml-rs?
The text was updated successfully, but these errors were encountered: