[][src]Trait sp_wasm_interface::FunctionContext

pub trait FunctionContext {
    pub fn read_memory_into(
        &self,
        address: Pointer<u8>,
        dest: &mut [u8]
    ) -> Result<()>;
pub fn write_memory(
        &mut self,
        address: Pointer<u8>,
        data: &[u8]
    ) -> Result<()>;
pub fn allocate_memory(&mut self, size: WordSize) -> Result<Pointer<u8>>;
pub fn deallocate_memory(&mut self, ptr: Pointer<u8>) -> Result<()>;
pub fn sandbox(&mut self) -> &mut dyn Sandbox; pub 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

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

Read memory into the given dest buffer from address.

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

Write the given data at address into the memory.

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

Allocate a memory instance of size bytes.

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

Deallocate a given memory instance.

pub fn sandbox(&mut self) -> &mut dyn Sandbox

Provides access to the sandbox.

Loading content...

Provided methods

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

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...