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§
Sourcefn read(&mut self, read: WasmMemoryRead) -> Result<Vec<u8>, MemoryAccessError>
fn read(&mut self, read: WasmMemoryRead) -> Result<Vec<u8>, MemoryAccessError>
Read from owned memory to new byte vector.
Sourcefn read_as<T: Sized>(
&mut self,
read: WasmMemoryReadAs<T>,
) -> Result<T, MemoryAccessError>
fn read_as<T: Sized>( &mut self, read: WasmMemoryReadAs<T>, ) -> Result<T, MemoryAccessError>
Read from owned memory to new object T.
Sourcefn read_decoded<T: Decode + MaxEncodedLen>(
&mut self,
read: WasmMemoryReadDecoded<T>,
) -> Result<T, MemoryAccessError>
fn read_decoded<T: Decode + MaxEncodedLen>( &mut self, read: WasmMemoryReadDecoded<T>, ) -> Result<T, MemoryAccessError>
Read from owned memory and decoded data into object T.
Sourcefn write(
&mut self,
write: WasmMemoryWrite,
buff: &[u8],
) -> Result<(), MemoryAccessError>
fn write( &mut self, write: WasmMemoryWrite, buff: &[u8], ) -> Result<(), MemoryAccessError>
Write data from buff to owned memory.
Sourcefn write_as<T: Sized>(
&mut self,
write: WasmMemoryWriteAs<T>,
obj: T,
) -> Result<(), MemoryAccessError>
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.