Skip to main content

Memory

Trait Memory 

Source
pub trait Memory:
    Debug
    + Send
    + Sync {
    // Required methods
    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§

Source

fn ty(&self) -> MemoryType

Returns the memory type for this memory.

Source

fn style(&self) -> &MemoryStyle

Returns the memory style for this memory.

Source

fn size(&self) -> Pages

Returns the number of allocated wasm pages.

Source

fn grow(&self, delta: Pages) -> Result<Pages, MemoryError>

Grow memory by the specified amount of wasm pages.

Source

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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§