pub trait Memory: Debug + Send + Sync + MemoryUsage {
fn ty(&self) -> MemoryType;
fn style(&self) -> &MemoryStyle;
fn size(&self) -> Pages;
fn grow(&self, delta: Pages) -> Result<Pages, MemoryError>;
fn vmmemory(&self) -> NonNull<VMMemoryDefinition>;
}
Expand description
Trait for implementing Wasm Memory used by Wasmer.
Required methods
fn ty(&self) -> MemoryType
fn ty(&self) -> MemoryType
Returns the memory type for this memory.
fn style(&self) -> &MemoryStyle
fn style(&self) -> &MemoryStyle
Returns the memory style for this memory.
Grow memory by the specified amount of wasm pages.
fn vmmemory(&self) -> NonNull<VMMemoryDefinition>
fn vmmemory(&self) -> NonNull<VMMemoryDefinition>
Return a VMMemoryDefinition
for exposing the memory to compiled wasm code.
The pointer returned in VMMemoryDefinition
must be valid for the lifetime of this memory.
Implementations on Foreign Types
sourceimpl Memory for LinearMemory
impl Memory for LinearMemory
sourcepub fn ty(&self) -> MemoryType
pub fn ty(&self) -> MemoryType
Returns the type for this memory.
sourcepub fn style(&self) -> &MemoryStyle
pub fn style(&self) -> &MemoryStyle
Returns the memory style for this memory.
sourcepub fn grow(&self, delta: Pages) -> Result<Pages, MemoryError>
pub fn grow(&self, delta: Pages) -> Result<Pages, MemoryError>
Grow memory by the specified amount of wasm pages.
Returns None
if memory can’t be grown by the specified amount
of wasm pages.
sourcepub fn vmmemory(&self) -> NonNull<VMMemoryDefinition>
pub fn vmmemory(&self) -> NonNull<VMMemoryDefinition>
Return a VMMemoryDefinition
for exposing the memory to compiled wasm code.