I try to create a xml string from a struct in rust. The struct is nested and I'm always getting duplicate tags in xml. I'm using serde-xml-rs version 0.5.1.
#[derive(Serialize, Debug)]
struct A {
#[serde(rename(serialize = "B"))]
pub b: B
}
#[derive(Serialize, Debug)]
struct B {
pub c: String
}
let foo = A {
b: B {
c: "bar".to_string()
}
};
println!("{:?}", to_string(&foo));
This produces
<A>
<B>
<B>
<c>bar</c>
</B>
</B>
</A>
What I expect:
<A>
<B>
<c>bar</c>
</B>
</A>
How can I get just one B tag?