Trait MemoryContext

Source
pub trait MemoryContext {
    // Required methods
    fn get_memory(&self) -> &Memory;
    fn get_alloc(&self) -> &NativeFunc<u32, WasmPtr<u8, Array>>;

    // Provided methods
    fn write_bytes_to_memory(
        &self,
        value: Vec<u8>,
        val_ptr_ptr: u32,
    ) -> Result<u32> { ... }
    fn read_bytes_from_memory(&self, offset: u32, len: u32) -> Result<Vec<u8>> { ... }
}
Expand description

Memory context is used by Wasmer Environment for read-write access to WASM linear memory.

Required Methods§

Provided Methods§

Source

fn write_bytes_to_memory(&self, value: Vec<u8>, val_ptr_ptr: u32) -> Result<u32>

set the return values to memory and return the length

Source

fn read_bytes_from_memory(&self, offset: u32, len: u32) -> Result<Vec<u8>>

read bytes from memory given the offset and len of the memory location

Implementors§