pub trait Instance {
Show 16 methods
// Required methods
fn call(&self, func_name: &str) -> Result<(), String>;
fn check_signatures(&self) -> bool;
fn has_function(&self, func_name: &str) -> bool;
fn get_exported_function_names(&self) -> Vec<String>;
fn set_points_limit(&self, limit: u64) -> Result<(), String>;
fn set_points_used(&self, points: u64) -> Result<(), String>;
fn get_points_used(&self) -> Result<u64, String>;
fn memory_length(&self) -> Result<u64, String>;
fn memory_ptr(&self) -> Result<*mut u8, String>;
fn memory_load(
&self,
mem_ptr: MemPtr,
mem_length: MemLength,
) -> Result<&[u8], ExecutorError>;
fn memory_store(
&self,
mem_ptr: MemPtr,
data: &[u8],
) -> Result<(), ExecutorError>;
fn memory_grow(&self, by_num_pages: u32) -> Result<u32, ExecutorError>;
fn set_breakpoint_value(&self, value: BreakpointValue) -> Result<(), String>;
fn get_breakpoint_value(&self) -> Result<BreakpointValue, String>;
fn reset(&self) -> Result<(), String>;
fn cache(&self) -> Result<Vec<u8>, String>;
}
Required Methods§
Sourcefn call(&self, func_name: &str) -> Result<(), String>
fn call(&self, func_name: &str) -> Result<(), String>
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 set_points_limit(&self, limit: u64) -> Result<(), String>
fn set_points_limit(&self, limit: u64) -> Result<(), String>
Sets the number of points(gas) limit for the given instance.
Sourcefn set_points_used(&self, points: u64) -> Result<(), String>
fn set_points_used(&self, points: u64) -> Result<(), String>
Sets the number of points(gas) for the given instance.
Sourcefn get_points_used(&self) -> Result<u64, String>
fn get_points_used(&self) -> Result<u64, String>
Returns the number of points(gas) used by the given instance.
Sourcefn memory_length(&self) -> Result<u64, String>
fn memory_length(&self) -> Result<u64, String>
Gets the size in bytes of the memory data.
Sourcefn memory_ptr(&self) -> Result<*mut u8, String>
fn memory_ptr(&self) -> Result<*mut u8, String>
Gets a pointer to the beginning of the contiguous memory data bytes.
Sourcefn memory_load(
&self,
mem_ptr: MemPtr,
mem_length: MemLength,
) -> Result<&[u8], ExecutorError>
fn memory_load( &self, mem_ptr: MemPtr, mem_length: MemLength, ) -> Result<&[u8], ExecutorError>
Loads data from executor memory.
Sourcefn memory_store(
&self,
mem_ptr: MemPtr,
data: &[u8],
) -> Result<(), ExecutorError>
fn memory_store( &self, mem_ptr: MemPtr, data: &[u8], ) -> Result<(), ExecutorError>
Loads data from executor memory.
Sourcefn memory_grow(&self, by_num_pages: u32) -> Result<u32, ExecutorError>
fn memory_grow(&self, by_num_pages: u32) -> Result<u32, ExecutorError>
Grows a memory by the given number of pages (of 65Kb each).
Sourcefn set_breakpoint_value(&self, value: BreakpointValue) -> Result<(), String>
fn set_breakpoint_value(&self, value: BreakpointValue) -> Result<(), String>
Sets the runtime breakpoint value for the given instance.
Sourcefn get_breakpoint_value(&self) -> Result<BreakpointValue, String>
fn get_breakpoint_value(&self) -> Result<BreakpointValue, String>
Returns the runtime breakpoint value from the given instance.