conspire/geometry/ntree/read/
mod.rs1use crate::geometry::ntree::node::slot::Slot;
2pub(super) mod htg;
3
4use crate::geometry::ntree::{Orthotree, node::cell::Cell};
5use std::{io::Error as ErrorIO, path::Path};
6
7use self::htg::ReadHtg;
8
9pub enum Input<P>
10where
11 P: AsRef<Path>,
12{
13 Htg(P),
14}
15
16impl<P> AsRef<Path> for Input<P>
17where
18 P: AsRef<Path>,
19{
20 fn as_ref(&self) -> &Path {
21 match self {
22 Input::Htg(path) => path.as_ref(),
23 }
24 }
25}
26
27impl<const D: usize, const L: usize, const M: usize, const N: usize, T, U, P> TryFrom<Input<P>>
28 for Orthotree<D, L, M, N, T, U>
29where
30 P: AsRef<Path>,
31 T: Cell,
32 U: Slot,
33{
34 type Error = ErrorIO;
35 fn try_from(input: Input<P>) -> Result<Self, Self::Error> {
36 match input {
37 Input::Htg(path) => Self::read_htg(path),
38 }
39 }
40}