pub trait DiffInstance {
// Required methods
fn name(&self) -> &'static str;
fn evaluate(
&mut self,
function_name: &str,
arguments: &[DiffValue],
results: &[DiffValueType],
) -> Result<Option<Vec<DiffValue>>>;
fn get_global(&mut self, name: &str, ty: DiffValueType) -> Option<DiffValue>;
fn get_memory(&mut self, name: &str, shared: bool) -> Option<Vec<u8>>;
}
Expand description
Provide a way to evaluate Wasm functions–a Wasm instance implemented by a specific engine (i.e., compiler or interpreter).
Required Methods§
Sourcefn evaluate(
&mut self,
function_name: &str,
arguments: &[DiffValue],
results: &[DiffValueType],
) -> Result<Option<Vec<DiffValue>>>
fn evaluate( &mut self, function_name: &str, arguments: &[DiffValue], results: &[DiffValueType], ) -> Result<Option<Vec<DiffValue>>>
Evaluate an exported function with the given values.
Any error, such as a trap, should be returned through an Err
. If this
engine cannot invoke the function signature then None
should be
returned and this invocation will be skipped.
Sourcefn get_global(&mut self, name: &str, ty: DiffValueType) -> Option<DiffValue>
fn get_global(&mut self, name: &str, ty: DiffValueType) -> Option<DiffValue>
Attempts to return the value of the specified global, returning None
if this engine doesn’t support retrieving globals at this time.