summaryrefslogtreecommitdiffstats
path: root/src/backends/mod.rs
blob: b01329888c83fed165929710855b894826e9d8f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use std::path::{ Path, PathBuf };

pub mod python;
pub mod clang;

pub use python::PythonBackend;
pub use clang::ClangBackend;

pub trait Backend {
    fn get_template(&self) -> Option<&str>;

    fn run(&self, fname: &Path) -> std::io::Result<()>;

    fn try_guess_test(&self, fname: &Path) -> Option<PathBuf> {
        let maybe_test = fname.with_extension("txt");
        if maybe_test.exists() {
            return Some(maybe_test);
        }
        None
    }
}