pub fn write_mzml<S: SpectrumSource + ?Sized, W: Write>(
src: &mut S,
out: &mut W,
) -> Result<()>Expand description
Write the source’s spectra as mzML 1.1.0 (un-indexed).
Examples found in repository?
examples/emit_sample_mzml.rs (line 154)
147fn main() -> std::io::Result<()> {
148 let mut args = std::env::args().skip(1);
149 let plain_path = args.next().unwrap_or_else(|| "sample_plain.mzML".into());
150 let indexed_path = args.next().unwrap_or_else(|| "sample_indexed.mzML".into());
151
152 let mut src = SampleSource::new();
153 let mut plain = BufWriter::new(File::create(&plain_path)?);
154 write_mzml(&mut src, &mut plain)
155 .map_err(|e| std::io::Error::other(format!("write_mzml: {e}")))?;
156
157 let mut indexed = BufWriter::new(File::create(&indexed_path)?);
158 write_indexed_mzml(&mut src, &mut indexed)
159 .map_err(|e| std::io::Error::other(format!("write_indexed_mzml: {e}")))?;
160
161 eprintln!("wrote {plain_path} and {indexed_path}");
162 Ok(())
163}