This avoids the need for an expensive clone. Since we switched to AsXml
instead of IntoXml, we don't necessarily have to clone the data when
building new elements, only when it's absolutely necessary. The clones
then happen implicitly in the ItemToEvent iterator used internally.
This mostly fixes #86, with the caveat that there's no absolutely cheap
test: On success, the entire element will be copied, while on failure,
you learn about it rather quickly.
@@ -29,8 +29,7 @@ mod helpers {
Ok(v) => v,
Err(e) => panic!("failed to parse from {:?}: {}", s, e),
};
- let recovered =- transform(structural.clone()).expect("roundtrip did not produce an element");
+ let recovered = transform(&structural).expect("roundtrip did not produce an element");
assert_eq!(initial, recovered);
let structural2: T = match try_from_element(recovered) {
Ok(v) => v,