pub unsafe trait MemoryCreator: Send + Sync {
// Required method
fn new_memory(
&self,
request: &MemoryRequest<'_>,
) -> Result<Box<dyn LinearMemory>>;
}runtime only.Expand description
A memory creator. Can be used to provide a memory creator to wasmtime which supplies host managed memory.
§Safety
This trait is unsafe, as the memory safety depends on proper implementation of memory management. Memories created by the MemoryCreator should always be treated as owned by wasmtime instance, and any modification of them outside of wasmtime invoked routines is unsafe and may lead to corruption.
Note that this is a relatively advanced feature and it is recommended to be familiar with Wasmtime runtime code to use it.
Required Methods§
Sourcefn new_memory(
&self,
request: &MemoryRequest<'_>,
) -> Result<Box<dyn LinearMemory>>
fn new_memory( &self, request: &MemoryRequest<'_>, ) -> Result<Box<dyn LinearMemory>>
Create a new LinearMemory object from the specified parameters.
The returned memory must satisfy all of the properties of the MemoryRequest
and be zero filled.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".