pub trait LinearMemorywhere
    Self: Debug + Send,{
    // Required methods
    fn ty(&self) -> MemoryType;
    fn size(&self) -> Pages;
    fn style(&self) -> MemoryStyle;
    fn grow(&mut self, delta: Pages) -> Result<Pages, MemoryError>;
    fn vmmemory(&self) -> NonNull<VMMemoryDefinition>;
    fn try_clone(&self) -> Option<Box<dyn LinearMemory + 'static>>;
    fn duplicate(
        &mut self
    ) -> Result<Box<dyn LinearMemory + 'static>, MemoryError>;
}
Expand description

Represents memory that is used by the WebAsssembly module

Required Methods§

source

fn ty(&self) -> MemoryType

Returns the type for this memory.

source

fn size(&self) -> Pages

Returns the size of hte memory in pages

source

fn style(&self) -> MemoryStyle

Returns the memory style for this memory.

source

fn grow(&mut 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.

source

fn vmmemory(&self) -> NonNull<VMMemoryDefinition>

Return a VMMemoryDefinition for exposing the memory to compiled wasm code.

source

fn try_clone(&self) -> Option<Box<dyn LinearMemory + 'static>>

Attempts to clone this memory (if its clonable)

source

fn duplicate(&mut self) -> Result<Box<dyn LinearMemory + 'static>, MemoryError>

Copies this memory to a new memory

Implementors§