1use std::{
2 fmt::Debug,
3 path::{Path, PathBuf},
4};
5
6use dyn_clone::DynClone;
7
8use crate::LocalObservation;
9
10pub mod svg;
12
13pub mod logger;
14
15pub trait Output: DynClone + Debug + Sync {
18 fn write_observations(
23 &self,
24 observations: &[LocalObservation],
25 observatory_name: &str,
26 time: i128,
27 output_path_root: &Path,
28 ) -> Result<(), std::io::Error>;
29
30 fn flush(&self) -> Result<(), std::io::Error> {
34 Ok(())
35 }
36}
37dyn_clone::clone_trait_object!(Output);
38
39#[must_use]
40pub fn to_default_path(
41 output_path_root: &Path,
42 observatory_name: &str,
43 time: i128,
44 extension: &str,
45) -> PathBuf {
46 let mut path = output_path_root.to_owned();
47 path.push(observatory_name);
48 path.push(format!("{time:010}{extension}"));
49
50 path
51}
52
53#[cfg(test)]
54mod tests {}