container_what/
common.rs

1use std::path::{Path, PathBuf};
2
3pub struct DetectorContext<'a> {
4    root: &'a Path
5}
6
7impl<'a> DetectorContext<'a> {
8    pub fn new(path: &'a Path) -> Self {
9        DetectorContext {
10            root: path
11        }
12    }
13
14    pub fn get_file_path(&self, path_str: &str) -> PathBuf {
15        let mut result = self.root.to_path_buf();
16        result.push(path_str);
17        result
18    }
19}
20
21pub trait Detector {
22    type D: ::std::fmt::Display;
23    fn detect(ctx: &DetectorContext) -> Self::D;
24}