serde-xml-rs icon indicating copy to clipboard operation
serde-xml-rs copied to clipboard

Error `DocumentStartAlreadyEmitted` while trying to serialize simple structure in 0.6.0

Open codebling opened this issue 2 years ago • 0 comments

The following extremely simple code reproduces the issue.

enum EnumOne {
  A(EnumTwo),
}

enum EnumTwo {
  Z(StructOne),
}

struct StructOne {
}

let obj = EnumOne::A(
  EnumTwo::Z (
    StructOne {
    }
  )
);
serde_xml_rs::to_string(&obj).unwrap();

And produces the following error

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Writer { source: DocumentStartAlreadyEmitted }', src/main.rs:24:33

I've created a minimal repo which reproduces the issue

Versions are serde = "1.0.152" serde-xml-rs = "0.6.0"

The code works in serde-xml-rs 0.5.1

codebling avatar Feb 09 '23 06:02 codebling