Skip to content

Error DocumentStartAlreadyEmitted while trying to serialize simple structure in 0.6.0 #197

@codebling

Description

@codebling

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions