Trait DiffInstance

Source
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§

Source

fn name(&self) -> &'static str

Return the name of the engine behind this instance.

Source

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.

Source

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.

Source

fn get_memory(&mut self, name: &str, shared: bool) -> Option<Vec<u8>>

Same as get_global but for memory.

Implementors§