Trait linera_witty::RuntimeMemory
source · pub trait RuntimeMemory<Instance> {
// Required methods
fn read<'instance>(
&self,
instance: &'instance Instance,
location: GuestPointer,
length: u32,
) -> Result<Cow<'instance, [u8]>, RuntimeError>;
fn write(
&mut self,
instance: &mut Instance,
location: GuestPointer,
bytes: &[u8],
) -> Result<(), RuntimeError>;
}
Expand description
Interface for accessing a runtime specific memory.
Required Methods§
sourcefn read<'instance>(
&self,
instance: &'instance Instance,
location: GuestPointer,
length: u32,
) -> Result<Cow<'instance, [u8]>, RuntimeError>
fn read<'instance>( &self, instance: &'instance Instance, location: GuestPointer, length: u32, ) -> Result<Cow<'instance, [u8]>, RuntimeError>
Reads length
bytes from memory from the provided location
.
sourcefn write(
&mut self,
instance: &mut Instance,
location: GuestPointer,
bytes: &[u8],
) -> Result<(), RuntimeError>
fn write( &mut self, instance: &mut Instance, location: GuestPointer, bytes: &[u8], ) -> Result<(), RuntimeError>
Writes the bytes
to memory at the provided location
.