Minimal reproducible example for a serialization issue encountered with the xrust crate.
Calling xrust::parser::xml::parse
with Rc<xrust::trees::smite::Node>
as the first argument, followed by xrust::trees::smite::Rc::to_xml
to serialize the parsed XML tree back to a string, does not produce a stable output. In particular, when performing this sequence of operations multiple times on the same source XML file, the order of attributes in the serialized XML output is different between calls.
- Clone this repo.
- Run
cargo run
in the root directory of the repo. - Observe the assertion failure.
Ideally, the output of multiple different parse
+ to_xml
calls on the same source XML file should be equivalent. This allows downstream consumers to rely on the output of to_xml
for testing and debugging purposes, such as snapshot testing.
The issue occurs with the released xrust
crate version 1.0.0
, as well as the latest commits on the main
branch (313aafd) and dev
branch (2449e4d) at the time of writing this README.