stationxml_rs/sc3ml/mod.rs
1//! SeisComP SC3ML 0.13 format backend.
2//!
3//! Implements [`StationXmlFormat`] for reading and writing
4//! SeisComP SC3ML documents (versions 0.6–0.13).
5
6pub(crate) mod reader;
7pub(crate) mod types;
8pub(crate) mod writer;
9
10use crate::error::Result;
11use crate::format::StationXmlFormat;
12use crate::inventory::Inventory;
13
14/// SeisComP SC3ML 0.13 format marker.
15///
16/// Use this with [`StationXmlFormat`] methods to read/write SC3ML.
17///
18/// ```no_run
19/// use stationxml_rs::{Sc3ml, StationXmlFormat};
20///
21/// let inv = Sc3ml::read_from_str("<seiscomp ...>...</seiscomp>").unwrap();
22/// let xml = Sc3ml::write_to_string(&inv).unwrap();
23/// ```
24pub struct Sc3ml;
25
26impl StationXmlFormat for Sc3ml {
27 fn read_from_str(xml: &str) -> Result<Inventory> {
28 reader::read_from_str(xml)
29 }
30
31 fn read_from_bytes(bytes: &[u8]) -> Result<Inventory> {
32 reader::read_from_bytes(bytes)
33 }
34
35 fn write_to_string(inventory: &Inventory) -> Result<String> {
36 writer::write_to_string(inventory)
37 }
38}