Skip to main content

document

Function document 

Source
pub fn document(design: &Design) -> Imported<Document>
Expand description

The design document for design, with a warning for anything kept from the file it came from that has no place in it any more.

let xml = br#"<?xml version="1.0" encoding="UTF-8"?>
<openrocket version="1.10" creator="OpenRocket 24.12">
  <rocket><name>Sounder</name><designer>A. Flyer</designer></rocket>
</openrocket>"#;
let read = hpr_io::ork::read(xml)?;
let design = hpr_io::ork::design(&read.value).value;

let written = hpr_io::ork::export::document(&design);
assert!(written.warnings.is_empty());
let text = written.value.to_xml();
// The name is the rocket's; the designer, which hpr does not read, was kept and put back.
assert!(text.contains("<name>Sounder</name>"), "{text}");
assert!(text.contains("<designer>A. Flyer</designer>"), "{text}");