dharitri_vm_executor

Trait Instance

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

Source

fn call(&self, func_name: &str) -> Result<(), String>

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 set_points_limit(&self, limit: u64) -> Result<(), String>

Sets the number of points(gas) limit for the given instance.

Source

fn set_points_used(&self, points: u64) -> Result<(), String>

Sets the number of points(gas) for the given instance.

Source

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

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

Source

fn memory_length(&self) -> Result<u64, String>

Gets the size in bytes of the memory data.

Source

fn memory_ptr(&self) -> Result<*mut u8, String>

Gets a pointer to the beginning of the contiguous memory data bytes.

Source

fn memory_load( &self, mem_ptr: MemPtr, mem_length: MemLength, ) -> Result<&[u8], ExecutorError>

Loads data from executor memory.

Source

fn memory_store( &self, mem_ptr: MemPtr, data: &[u8], ) -> Result<(), ExecutorError>

Loads data from executor memory.

Source

fn memory_grow(&self, by_num_pages: u32) -> Result<u32, ExecutorError>

Grows a memory by the given number of pages (of 65Kb each).

Source

fn set_breakpoint_value(&self, value: BreakpointValue) -> Result<(), String>

Sets the runtime breakpoint value for the given instance.

Source

fn get_breakpoint_value(&self) -> Result<BreakpointValue, String>

Returns the runtime breakpoint value from the given instance.

Source

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

Resets an instance, cleaning memories and globals.

Source

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

Caches an instance.

Implementors§