pub struct WasmtimeEngineConfig {
pub fuel_enabled: bool,
pub default_fuel: u64,
pub fuel_yield_interval: u64,
pub max_memory_bytes: usize,
pub max_table_elements: u32,
pub max_instances: u32,
pub strategy: CompilationStrategy,
pub simd_enabled: bool,
pub multi_memory: bool,
pub cache_dir: Option<PathBuf>,
pub compilation_threads: Option<usize>,
pub stack_size: usize,
}Expand description
Configuration for the Wasmtime-based Wasm engine.
Per Doc 02, Section 3.2: controls fuel, memory limits, compilation strategy, SIMD, caching, and parallelism.
§Invariants
default_fuelmust be > 0 whenfuel_enabledis true.max_memory_bytesmust be > 0.
§Examples
use torvyn_engine::WasmtimeEngineConfig;
let config = WasmtimeEngineConfig::default();
assert!(config.fuel_enabled);
assert_eq!(config.max_memory_bytes, 16 * 1024 * 1024);Fields§
§fuel_enabled: boolEnable fuel-based CPU budgeting.
When enabled, each component invocation is given a fuel allocation. Components that exceed their budget are preempted.
default_fuel: u64Default fuel budget per component invocation.
Per Doc 02, Section 3.2: default is 1,000,000.
fuel_yield_interval: u64Fuel yield interval for async cooperative preemption.
When set, Wasmtime yields back to the async executor after consuming this many fuel units, enabling cooperative multitasking. A value of 0 disables yield-on-fuel.
max_memory_bytes: usizeMaximum linear memory per component instance (bytes).
Per Doc 02, Section 3.2: default is 16 MiB.
max_table_elements: u32Maximum number of Wasm table elements per component instance.
max_instances: u32Maximum number of instances per store.
strategy: CompilationStrategyCompilation strategy.
simd_enabled: boolEnable Wasm SIMD instructions.
multi_memory: boolEnable Wasm multi-memory proposal.
cache_dir: Option<PathBuf>Compilation cache directory for serialized native code.
When Some, compiled components are serialized to disk and
deserialized on subsequent loads, avoiding recompilation.
compilation_threads: Option<usize>Number of parallel compilation threads.
None uses Wasmtime’s default (number of CPUs).
stack_size: usizeStack size for Wasm execution (bytes).
Default: 1 MiB. Controls the maximum call stack depth.
Implementations§
Trait Implementations§
Source§impl Clone for WasmtimeEngineConfig
impl Clone for WasmtimeEngineConfig
Source§fn clone(&self) -> WasmtimeEngineConfig
fn clone(&self) -> WasmtimeEngineConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WasmtimeEngineConfig
impl Debug for WasmtimeEngineConfig
Auto Trait Implementations§
impl Freeze for WasmtimeEngineConfig
impl RefUnwindSafe for WasmtimeEngineConfig
impl Send for WasmtimeEngineConfig
impl Sync for WasmtimeEngineConfig
impl Unpin for WasmtimeEngineConfig
impl UnsafeUnpin for WasmtimeEngineConfig
impl UnwindSafe for WasmtimeEngineConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more