pub trait InstanceWithMemory: CabiReallocAlias + CabiFreeAlias {
// Required method
fn memory_from_export(
&self,
export: <Self::Runtime as Runtime>::Export,
) -> Result<Option<<Self::Runtime as Runtime>::Memory>, RuntimeError>;
// Provided methods
fn memory(&mut self) -> Result<Memory<'_, Self>, RuntimeError> { ... }
fn load_memory(
&mut self,
) -> Result<<Self::Runtime as Runtime>::Memory, RuntimeError> { ... }
}Expand description
Trait alias for a Wasm module instance with the WIT Canonical ABI functions.
Required Methods§
Provided Methods§
Sourcefn memory(&mut self) -> Result<Memory<'_, Self>, RuntimeError>
fn memory(&mut self) -> Result<Memory<'_, Self>, RuntimeError>
Returns the memory export from the current Wasm module instance.
Sourcefn load_memory(
&mut self,
) -> Result<<Self::Runtime as Runtime>::Memory, RuntimeError>
fn load_memory( &mut self, ) -> Result<<Self::Runtime as Runtime>::Memory, RuntimeError>
Resolves the guest module’s memory export.
Runtimes may override this to cache the resolved handle and skip the export lookup on every host call.
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.