compose_library/
vm.rs

1use crate::diag::SourceResult;
2use crate::{Args, Engine};
3use compose_library::{Func, Heap, Value};
4
5pub trait Vm<'a> {
6    fn heap(&self) -> &Heap;
7    fn heap_mut(&mut self) -> &mut Heap;
8
9    fn engine(&self) -> &Engine<'a>;
10    fn engine_mut(&mut self) -> &mut Engine<'a>;
11
12    fn call_func(&mut self, func: &Func, args: Args) -> SourceResult<Value>;
13}
14
15#[cfg(test)]
16mod tests {
17    use compose_library::Vm;
18
19    /// Make sure that Vm is dyn compatible.
20    #[allow(dead_code)]
21    fn dyn_compatible(_vm: &mut dyn Vm) {}
22}