Skip to main content

write

Function write 

Source
pub fn write(file: &RseFile) -> Result<String, MotorError>
Expand description

Writes a .rse file in RockSim’s layout and attribute order, after an XML comment naming the program that wrote it, its version and its designation (<!-- hpr-sim 0.1.0 · FS · SW · TOOL 005 -->, hpr_core::tool::stamp). RockSim’s files start at <engine-database> with no XML declaration, so the comment is the first line. The reader, as any XML reader, skips comments, so the file reads back the same.

§Errors

  • MotorError::Inconsistent for no engines, an engine with fewer than two points, points of which only some carry m or cg, or text holding a character XML 1.0 can’t carry.
  • MotorError::Domain for the values the reader rejects: non-finite numbers, a non-positive diameter or length, negative masses or times, and decreasing times.