MemoryOwner

Trait MemoryOwner 

Source
pub trait MemoryOwner {
    // Required methods
    fn read(
        &mut self,
        read: WasmMemoryRead,
    ) -> Result<Vec<u8>, MemoryAccessError>;
    fn read_as<T: Sized>(
        &mut self,
        read: WasmMemoryReadAs<T>,
    ) -> Result<T, MemoryAccessError>;
    fn read_decoded<T: Decode + MaxEncodedLen>(
        &mut self,
        read: WasmMemoryReadDecoded<T>,
    ) -> Result<T, MemoryAccessError>;
    fn write(
        &mut self,
        write: WasmMemoryWrite,
        buff: &[u8],
    ) -> Result<(), MemoryAccessError>;
    fn write_as<T: Sized>(
        &mut self,
        write: WasmMemoryWriteAs<T>,
        obj: T,
    ) -> Result<(), MemoryAccessError>;
}

Required Methods§

Source

fn read(&mut self, read: WasmMemoryRead) -> Result<Vec<u8>, MemoryAccessError>

Read from owned memory to new byte vector.

Source

fn read_as<T: Sized>( &mut self, read: WasmMemoryReadAs<T>, ) -> Result<T, MemoryAccessError>

Read from owned memory to new object T.

Source

fn read_decoded<T: Decode + MaxEncodedLen>( &mut self, read: WasmMemoryReadDecoded<T>, ) -> Result<T, MemoryAccessError>

Read from owned memory and decoded data into object T.

Source

fn write( &mut self, write: WasmMemoryWrite, buff: &[u8], ) -> Result<(), MemoryAccessError>

Write data from buff to owned memory.

Source

fn write_as<T: Sized>( &mut self, write: WasmMemoryWriteAs<T>, obj: T, ) -> Result<(), MemoryAccessError>

Write data from obj to owned memory.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§