conspire/geometry/ntree/write/
mod.rs1pub mod htg;
2
3use crate::{geometry::ntree::Orthotree, io::Write, math::Scalar};
4use std::{io::Error as ErrorIO, path::Path};
5
6use self::htg::WriteHtg;
7
8pub enum Output<P>
9where
10 P: AsRef<Path>,
11{
12 Htg(P),
13}
14
15impl<P> AsRef<Path> for Output<P>
16where
17 P: AsRef<Path>,
18{
19 fn as_ref(&self) -> &Path {
20 match self {
21 Output::Htg(path) => path.as_ref(),
22 }
23 }
24}
25
26impl<const D: usize, const L: usize, const M: usize, const N: usize, T, U, P> Write<Output<P>>
27 for Orthotree<D, L, M, N, T, U>
28where
29 P: AsRef<Path>,
30 T: Copy + Into<Scalar> + Into<usize>,
31 U: Copy + Into<usize>,
32{
33 type Error = ErrorIO;
34 fn write(&self, output: Output<P>) -> Result<(), Self::Error> {
35 match output {
36 Output::Htg(path) => self.write_htg(path)?,
37 }
38 Ok(())
39 }
40}