1#![allow(non_camel_case_types)]
2pub mod ome;
3
4pub mod error;
5#[cfg(feature = "python")]
6mod py;
7
8use crate::error::Error;
9pub use ome::Ome;
10use quick_xml::de::from_str;
11use std::str::FromStr;
12
13impl FromStr for Ome {
14 type Err = Error;
15
16 fn from_str(s: &str) -> Result<Self, Error> {
17 Ok(from_str(s)?)
18 }
19}
20
21#[cfg(test)]
22mod tests {
23 use super::*;
24 use std::fs::read_to_string;
25
26 macro_rules! test_read {
27 ($($name:ident: $file:expr $(,)?)*) => {
28 $(
29 #[test]
30 fn $name() -> Result<(), Error> {
31 let file = read_to_string(format!("tests/{}.xml", $file))?;
32 let _ome: Ome = file.parse()?;
33 Ok(())
34 }
35 )*
36 };
37 }
38
39 test_read!(
40 a: "YTL1849A111_2023_05_04__14_46_19_cellnr_1_track"
41 b: "Experiment-2029"
42 c: "test"
43 d: "4-Pos_001_002"
44 e: "YTL1841B2-2-1_1hr_DMSO_galinduction_1"
45 f: "1xp53-01-AP1"
46 g: "YTL378_JF552"
47 h: "MK022_cE9_1-01-Airyscan Processing-01-Scene-2-P1"
48 i: "beads_2023_05_04__19_00_22"
49 j: "20230511-p53-4x-CMV-1min-4h-01-Airyscan Processing-01"
50 k: "YTL1849A131_2023_05_04__13_36_36"
51 );
52}