drt_chain_vm_executor/
executor.rs

1use crate::{CompilationOptions, ExecutorError, Instance, OpcodeCost};
2
3use std::ffi::c_void;
4
5pub trait Executor {
6    /// Sets the data that can be hold by an instance context.
7    fn set_vm_hooks_ptr(&mut self, vm_hooks_ptr: *mut c_void) -> Result<(), ExecutorError>;
8
9    /// Sets the opcode costs for the given executor.
10    fn set_opcode_cost(&mut self, opcode_cost: &OpcodeCost) -> Result<(), ExecutorError>;
11
12    /// Creates a new VM executor instance.
13    fn new_instance(
14        &self,
15        wasm_bytes: &[u8],
16        compilation_options: &CompilationOptions,
17    ) -> Result<Box<dyn Instance>, ExecutorError>;
18
19    /// Creates a new VM executor instance from cache.
20    fn new_instance_from_cache(
21        &self,
22        cache_bytes: &[u8],
23        compilation_options: &CompilationOptions,
24    ) -> Result<Box<dyn Instance>, ExecutorError>;
25}