Trait wasmer_vm::LinearMemory
source · 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>;
// Provided methods
fn do_wait(
&mut self,
_dst: NotifyLocation,
_timeout: Option<Duration>
) -> Result<u32, WaiterError> { ... }
fn do_notify(&mut self, _dst: NotifyLocation, _count: u32) -> u32 { ... }
}
Expand description
Represents memory that is used by the WebAsssembly module
Required Methods§
sourcefn ty(&self) -> MemoryType
fn ty(&self) -> MemoryType
Returns the type for this memory.
sourcefn style(&self) -> MemoryStyle
fn style(&self) -> MemoryStyle
Returns the memory style for this memory.
sourcefn grow(&mut self, delta: Pages) -> Result<Pages, MemoryError>
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.
sourcefn vmmemory(&self) -> NonNull<VMMemoryDefinition>
fn vmmemory(&self) -> NonNull<VMMemoryDefinition>
Return a VMMemoryDefinition
for exposing the memory to compiled wasm code.
sourcefn try_clone(&self) -> Option<Box<dyn LinearMemory + 'static>>
fn try_clone(&self) -> Option<Box<dyn LinearMemory + 'static>>
Attempts to clone this memory (if its clonable)
sourcefn duplicate(&mut self) -> Result<Box<dyn LinearMemory + 'static>, MemoryError>
fn duplicate(&mut self) -> Result<Box<dyn LinearMemory + 'static>, MemoryError>
Copies this memory to a new memory
Provided Methods§
sourcefn do_wait(
&mut self,
_dst: NotifyLocation,
_timeout: Option<Duration>
) -> Result<u32, WaiterError>
fn do_wait( &mut self, _dst: NotifyLocation, _timeout: Option<Duration> ) -> Result<u32, WaiterError>
Add current thread to the waiter hash, and wait until notified or timout. Return 0 if the waiter has been notified, 2 if the timeout occured, or None if en error happened
sourcefn do_notify(&mut self, _dst: NotifyLocation, _count: u32) -> u32
fn do_notify(&mut self, _dst: NotifyLocation, _count: u32) -> u32
Notify waiters from the wait list. Return the number of waiters notified