Trait Instance

Source
pub trait Instance {
    // Required methods
    fn call(&mut self, func_name: &str, points_limit: u64) -> InstanceCallResult;
    fn check_signatures(&self) -> bool;
    fn has_function(&self, func_name: &str) -> bool;
    fn get_exported_function_names(&self) -> Vec<String>;
    fn get_points_used(&mut self) -> Result<u64, ExecutorError>;
    fn reset(&self) -> Result<(), ExecutorError>;
    fn cache(&self) -> Result<Vec<u8>, ExecutorError>;
}
Expand description

The new instance trait, only used for configuring & calling the wasmer instance.

Required Methods§

Source

fn call(&mut self, func_name: &str, points_limit: u64) -> InstanceCallResult

Calls an exported function of a WebAssembly instance by name.

Source

fn check_signatures(&self) -> bool

Checks that all public module functions (SC endpoints) have no arguments or results.

Source

fn has_function(&self, func_name: &str) -> bool

Checks whether SC has an endpoint with given name.

Source

fn get_exported_function_names(&self) -> Vec<String>

Required to be able to extract all SC endpoint names.

Source

fn get_points_used(&mut self) -> Result<u64, ExecutorError>

Returns the number of points(gas) used by the given instance.

Source

fn reset(&self) -> Result<(), ExecutorError>

Resets an instance, cleaning memories and globals.

Source

fn cache(&self) -> Result<Vec<u8>, ExecutorError>

Caches an instance.

Implementors§