rusty_systems/
interpretation.rs1use std::fmt::Debug;
2use crate::prelude::{ProductionString, RunSettings, System};
3use crate::symbols::SymbolStore;
4
5pub mod abop;
6pub mod svg;
7
8pub trait Interpretation: Debug + Sync + Send + Default {
9 type Item;
10
11 fn system() -> crate::Result<System>;
18
19 fn interpret<S: SymbolStore>(&self,
20 symbols: &S,
21 string: &ProductionString) -> crate::Result<Self::Item>;
22
23
24 fn default_interpret<S: SymbolStore>(symbols: &S,
25 string: &ProductionString) -> crate::Result<Self::Item> {
26 let instance = Self::default();
27 instance.interpret(symbols, string)
28 }
29
30 fn run_settings(&self) -> RunSettings {
34 RunSettings::default()
35 }
36
37}
38
39#[derive(Debug, Clone, Default)]
41pub struct NullInterpretation {
42}
43
44impl NullInterpretation {
45}
46
47impl Interpretation for NullInterpretation {
48 type Item = ();
49
50 #[inline]
51 fn system() -> crate::Result<System> {
52 Ok(System::default())
53 }
54
55 #[inline]
56 fn interpret<S: SymbolStore>(&self, _: &S, _: &ProductionString) -> crate::Result<Self::Item> {
57 Ok(())
58 }
59}