summaryrefslogtreecommitdiffstats
path: root/src/backends/mod.rs
blob: 729daa5b436856544535084c0eaa699ccab94a9f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
    }
}