-
Notifications
You must be signed in to change notification settings - Fork 3
/
write_to_file.rs
25 lines (24 loc) · 1.03 KB
/
write_to_file.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use rust_sbml::ModelRaw;
fn main() {
let example = r#"<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version2/core" level="3" version="2">
<model timeUnits="second" extentUnits="mole" substanceUnits="mole">
<listOfReactions>
<reaction id='J1' reversible='false'>
<listOfReactants>
<speciesReference species='X0' stoichiometry='2' constant='true'/>
</listOfReactants>
</reaction>
<reaction id='J2' reversible='false'>
<listOfReactants>
<speciesReference species='CAP' stoichiometry='2' constant='true'/>
<speciesReference species='ZOOM' stoichiometry='-2' constant='true'/>
</listOfReactants>
</reaction>
</listOfReactions>
</model>
</sbml>"#;
let res = ModelRaw::parse(&example).unwrap();
println!("{:?}", res);
std::fs::write("from_memory.xml", res.to_string().unwrap()).unwrap();
}