mandos/
interpret_trait.rs1use std::path::PathBuf;
2
3#[derive(Default)]
4pub struct InterpreterContext {
5 pub context_path: PathBuf,
6}
7
8impl InterpreterContext {
9 pub fn new(context_path: PathBuf) -> Self {
10 InterpreterContext { context_path }
11 }
12}
13
14pub trait InterpretableFrom<T> {
15 fn interpret_from(from: T, context: &InterpreterContext) -> Self;
16}
17
18impl<T> InterpretableFrom<T> for T {
19 fn interpret_from(from: T, _context: &InterpreterContext) -> Self {
20 from
21 }
22}
23
24impl<T: Clone> InterpretableFrom<&T> for T {
25 fn interpret_from(from: &T, _context: &InterpreterContext) -> Self {
26 from.clone()
27 }
28}
29
30pub trait IntoRaw<R> {
31 fn into_raw(self) -> R;
32}