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