Trait wasmtime::StackMemory

source ·
pub unsafe trait StackMemory: Send + Sync {
    // Required methods
    fn top(&self) -> *mut u8;
    fn range(&self) -> Range<usize>;
}
Expand description

A stack memory. This trait provides an interface for raw memory buffers which are used by wasmtime inside of stacks which wasmtime executes WebAssembly in for async support. By implementing this trait together with StackCreator, one can supply wasmtime with custom allocated host managed stacks.

§Safety

The memory should be page aligned and a multiple of page size. To prevent possible silent overflows, the memory should be protected by a guard page. Additionally the safety concerns explained in [‘Memory’], for accessing the memory apply here as well.

Note that this is a relatively new and experimental feature and it is recommended to be familiar with wasmtime runtime code to use it.

Required Methods§

source

fn top(&self) -> *mut u8

The top of the allocated stack.

This address should be page aligned.

source

fn range(&self) -> Range<usize>

The range of where this stack resides in memory, excluding guard pages.

Implementors§