Minimal reproducible example for a serialization issue encountered with the xrust crate.

Issue

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.

Steps to reproduce

  1. Clone this repo.
  2. Run cargo run in the root directory of the repo.
  3. Observe the assertion failure.

Expected behavior

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.

Notes

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.