#[derive(Debug, FromXml, PartialEq, ToXml)]
#[xml(forward)]
enum FooCollection {
Bar(Vec<Bar>),
Baz(Vec<Baz>),
}
#[derive(Debug, FromXml, PartialEq, ToXml)]
struct CollectionOwner {
collection: FooCollection,
}
#[test]
fn wrapped_enum_collection() {
let v = CollectionOwner {
collection: FooCollection::Bar(vec![Bar { bar: 42 }, Bar { bar: 56 }]),
};
let xml =
r#"<CollectionOwner><Bar><bar>42</bar></Bar><Bar><bar>56</bar></Bar></CollectionOwner>"#;
assert_eq!(xml, to_string(&v).unwrap()); //this produces the expected result
assert_eq!(v, from_str(xml).unwrap()); //this fails because only the first bar element is deserialized
}
I can help to fix this as well, however its not super clear to me where exactly the fix shall be? Should the macro generated deserialize_forward_enum account for this or the from_str implementation itself should account for multiple element case?
I can help to fix this as well, however its not super clear to me where exactly the fix shall be? Should the macro generated
deserialize_forward_enumaccount for this or thefrom_strimplementation itself should account for multiple element case?