Open JonathanBrouwer opened 5 months ago
The following example fails:
#[derive(YaSerialize, YaDeserialize)] pub struct Test { v: String } #[test] fn test() { let v = Test { v: "".to_string() }; yaserde::de::from_str::<Test>(&dbg!(yaserde::ser::to_string(&v).unwrap())).unwrap(); }
The struct is correctly serialized to:
<?xml version=\"1.0\" encoding=\"utf-8\"?><Test><v></v></Test>
The error message is "v is a required field of Test". The problem occurs because the visit_str function is not called since there is no string.
visit_str
In fact xml-rs does not handle event XmlEvent::Characters.
So only a StartElement and EndElement are emitted.
So specific code has to be done for that case, without breaking the rest :P
The following example fails:
The struct is correctly serialized to:
The error message is "v is a required field of Test". The problem occurs because the
visit_str
function is not called since there is no string.