Trait sp_wasm_interface::FunctionContext[][src]

pub trait FunctionContext {
    fn read_memory_into(
        &self,
        address: Pointer<u8>,
        dest: &mut [u8]
    ) -> Result<()>;
fn write_memory(&mut self, address: Pointer<u8>, data: &[u8]) -> Result<()>;
fn allocate_memory(&mut self, size: WordSize) -> Result<Pointer<u8>>;
fn deallocate_memory(&mut self, ptr: Pointer<u8>) -> Result<()>;
fn sandbox(&mut self) -> &mut dyn Sandbox; fn read_memory(
        &self,
        address: Pointer<u8>,
        size: WordSize
    ) -> Result<Vec<u8>> { ... } }

Context used by Function to interact with the allocator and the memory of the wasm instance.

Required methods

fn read_memory_into(&self, address: Pointer<u8>, dest: &mut [u8]) -> Result<()>[src]

Read memory into the given dest buffer from address.

fn write_memory(&mut self, address: Pointer<u8>, data: &[u8]) -> Result<()>[src]

Write the given data at address into the memory.

fn allocate_memory(&mut self, size: WordSize) -> Result<Pointer<u8>>[src]

Allocate a memory instance of size bytes.

fn deallocate_memory(&mut self, ptr: Pointer<u8>) -> Result<()>[src]

Deallocate a given memory instance.

fn sandbox(&mut self) -> &mut dyn Sandbox[src]

Provides access to the sandbox.

Loading content...

Provided methods

fn read_memory(&self, address: Pointer<u8>, size: WordSize) -> Result<Vec<u8>>[src]

Read memory from address into a vector.

Loading content...

Trait Implementations

impl ReadPrimitive<u32> for &mut dyn FunctionContext[src]

impl ReadPrimitive<u64> for &mut dyn FunctionContext[src]

impl WritePrimitive<u32> for &mut dyn FunctionContext[src]

impl WritePrimitive<u64> for &mut dyn FunctionContext[src]

Implementors

Loading content...