1use std::{
2 fmt::{Debug, Display},
3 hash::Hash,
4};
5
6use crate::DatapathFile;
7
8pub trait Datapath
9where
10 Self: Send + Sync + 'static,
11 Self: Clone + Sized,
12 Self: Eq + PartialEq + Hash,
13 Self: Debug + Display,
14{
15 const PATTERN: &'static str;
17
18 type Tuple;
20
21 type WildcardableTuple;
23
24 fn from_tuple(tuple: Self::Tuple) -> Self;
25 fn to_tuple(self) -> Self::Tuple;
26
27 fn from_wildcardable(tuple: Self::WildcardableTuple) -> String;
29
30 fn with_file(&self, file: impl Into<String>) -> DatapathFile<Self>;
32
33 fn parse(path: &str) -> Option<DatapathFile<Self>>;
36
37 fn field(&self, name: &str) -> Option<String>;
40}