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§
Sourcefn call(&mut self, func_name: &str, points_limit: u64) -> InstanceCallResult
fn call(&mut self, func_name: &str, points_limit: u64) -> InstanceCallResult
Calls an exported function of a WebAssembly instance by name
.
Sourcefn check_signatures(&self) -> bool
fn check_signatures(&self) -> bool
Checks that all public module functions (SC endpoints) have no arguments or results.
Sourcefn has_function(&self, func_name: &str) -> bool
fn has_function(&self, func_name: &str) -> bool
Checks whether SC has an endpoint with given name.
Sourcefn get_exported_function_names(&self) -> Vec<String>
fn get_exported_function_names(&self) -> Vec<String>
Required to be able to extract all SC endpoint names.
Sourcefn get_points_used(&mut self) -> Result<u64, ExecutorError>
fn get_points_used(&mut self) -> Result<u64, ExecutorError>
Returns the number of points(gas) used by the given instance.
Sourcefn reset(&self) -> Result<(), ExecutorError>
fn reset(&self) -> Result<(), ExecutorError>
Resets an instance, cleaning memories and globals.