pub struct RuntimeConfig {
pub fuel: u64,
pub max_wasm_stack: usize,
pub memory_reservation: u64,
pub memory_guard_size: u64,
pub memory_reservation_for_growth: u64,
pub max_store_bytes: u64,
pub timeout: Option<Duration>,
pub async_yield_fuel: Option<u64>,
}Fields§
§fuel: u64§max_wasm_stack: usize§memory_reservation: u64§memory_guard_size: u64§memory_reservation_for_growth: u64§max_store_bytes: u64§timeout: Option<Duration>§async_yield_fuel: Option<u64>Implementations§
Source§impl RuntimeConfig
impl RuntimeConfig
Sourcepub fn native_stack_size(&self) -> usize
pub fn native_stack_size(&self) -> usize
The native stack a thread running programs under this config needs.
max_wasm_stack is an interpreter budget, but a host call that re-enters
Wasm (a callback passed to map, say) nests interpreter frames on the
thread’s own stack. The engine charges each crossing 4 KiB of the budget
so re-entry traps before the thread overflows; a debug build spends up to
~64 KiB of native stack per crossing, so the thread is sized well past the
budget. An overflow here would abort every session in the process.
pub fn engine(&self) -> Result<Engine>
Sourcepub fn engine_async(&self) -> Result<Engine>
pub fn engine_async(&self) -> Result<Engine>
Same as engine. Config::async_support is a no-op in
wasmtime 44+; this entry point exists so async embedders have a distinct
call site to evolve independently.
pub fn wasmtime_config(&self) -> Config
pub fn store<T>(&self, engine: &Engine, data: T) -> Result<Store<T>>
pub fn store_async<T>(&self, engine: &Engine, data: T) -> Result<Store<T>>
Sourcepub fn arm_timeout(&self, engine: &Engine) -> Result<Option<Watchdog>>
pub fn arm_timeout(&self, engine: &Engine) -> Result<Option<Watchdog>>
Arm the configured timeout, failing setup if its thread cannot be created. Keep the returned guard alive until guest execution finishes.
Sourcepub async fn run(&self, wasm_bytes: &[u8]) -> Result<RunResult>
pub async fn run(&self, wasm_bytes: &[u8]) -> Result<RunResult>
One-shot runner: compile, instantiate, call main, return typed result
and captured console. Async like the rest of the runtime — a caller that
isn’t on a runtime bridges it itself (pollster::block_on for
compute/fs-only programs, a tokio runtime when http is involved). For
live console streaming, build a custom Store<StoreData> and call
dispatch_main_async directly.