-
Notifications
You must be signed in to change notification settings - Fork 276
Closed
Labels
questionserdeIssues related to mapping from Rust types to XMLIssues related to mapping from Rust types to XML
Description
Hi,
I have XML that has container/wrapper types around collections of nodes and I'd like to skip them when parsing, for example:
<Response>
<Entities count="2">
<Entity />
<Entity />
</Entities>
</Response>i.e it works when I provide a struct Entities as a container that holds children:
#[derive(Deserialize, Debug)]
pub struct Response {
#[serde(rename = "Entities")]
entities: Entities,
}
#[derive(Deserialize, Debug)]
struct Entities {
count: u32,
#[serde(rename = "Entity")]
children: Vec<Entity>,
}
#[derive(Deserialize, Debug)]
struct Entity {
///...
}But what I would really like to do is to eliminate the struct Entities and have a Vec<Entity> instead, i.e:
#[derive(Deserialize, Debug)]
pub struct Response {
#[serde(rename = "Entities")]
entities: Vec<Entity>,
}How would one achieve that?
Thank you.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
questionserdeIssues related to mapping from Rust types to XMLIssues related to mapping from Rust types to XML