Skip to main content

Config

Struct Config 

Source
pub struct Config { /* private fields */ }
Expand description

Global configuration for an crate::Engine. Builder methods return &mut Self.

Implementations§

Source§

impl Config

Source

pub fn new() -> Self

Creates a configuration with default settings.

Source

pub fn consume_fuel(&mut self, enable: bool) -> &mut Self

Enables fuel consumption (metering). Off by default.

Source

pub fn epoch_interruption(&mut self, enable: bool) -> &mut Self

Enables epoch-based interruption. Off by default.

Source

pub fn max_wasm_stack(&mut self, size: usize) -> &mut Self

Sets the maximum wasm operand-stack size, in bytes.

Source

pub fn max_module_bytes(&mut self, bytes: usize) -> &mut Self

Sets the default maximum module binary size, in bytes, that Module::new will compile on this engine — the untrusted-tier validation-time ceiling that bounds compiler memory against a hostile module before it ever executes (#32). Trusted/curated packages can raise it per-module via Module::new_with_limits.

Additive deviation from wasmtime — there is no analog in wasmtime::Config. The default is a finite ceiling (256 MiB, never unbounded), per the multi-tenant threat model.

Source

pub fn max_expanded_locals(&mut self, locals: usize) -> &mut Self

Sets the default maximum number of locals, summed over every function after run-length expansion, that Module::new will compile on this engine. wasmparser caps locals per function (50 000) but not per module, so without this a small module of many such functions could demand gigabytes from the compiler. Raised per-module for trusted packages via Module::new_with_limits.

Additive deviation from wasmtime — there is no analog in wasmtime::Config. The default is finite (8M locals; ~4× what a 256 MiB real-world module declares).

Source

pub fn wasm_multi_value(&mut self, enable: bool) -> &mut Self

Source

pub fn wasm_tail_call(&mut self, enable: bool) -> &mut Self

Source

pub fn wasm_bulk_memory(&mut self, enable: bool) -> &mut Self

Source

pub fn wasm_reference_types(&mut self, enable: bool) -> &mut Self

Source

pub fn wasm_function_references(&mut self, enable: bool) -> &mut Self

Source

pub fn wasm_gc(&mut self, enable: bool) -> &mut Self

Source

pub fn wasm_exceptions(&mut self, enable: bool) -> &mut Self

Source

pub fn memory_reservation(&mut self, bytes: u64) -> &mut Self

Source

pub fn memory_reservation_for_growth(&mut self, bytes: u64) -> &mut Self

Source

pub fn memory_may_move(&mut self, enable: bool) -> &mut Self

Source

pub fn memory_init_cow(&mut self, enable: bool) -> &mut Self

Source

pub fn memory_guard_size(&mut self, bytes: u64) -> &mut Self

Source

pub fn gc_heap_reservation(&mut self, bytes: u64) -> &mut Self

The GC heap’s pre-authorized reservation (bytes): the byte budget a store may grow its GC heap to without consulting the ResourceLimiter (the embedder has authorized it up front), and the cap on a single reservation-growth step. Growth beyond it is limiter-gated. Defaults to 0 (every grow consults the limiter). Unlike wasmtime this reserves a budget, not address space (we hold no mmap’d region).

Source

pub fn gc_heap_guard_size(&mut self, bytes: u64) -> &mut Self

Source

pub fn gc_heap_reservation_for_growth(&mut self, bytes: u64) -> &mut Self

Source

pub fn gc_heap_may_move(&mut self, enable: bool) -> &mut Self

Source

pub fn cranelift_opt_level(&mut self, level: OptLevel) -> &mut Self

Accepted for wasmtime parity; this interpreter has no Cranelift backend so the optimization level has no effect (compilation is a single linear pre-decode pass).

Source

pub fn wasm_backtrace(&mut self, enable: bool) -> &mut Self

Whether to capture a wasm backtrace on traps/exceptions. On by default. Also gates the cheap per-Op offset table + name-section retention used to symbolicate frames.

Source

pub fn wasm_backtrace_details( &mut self, enable: WasmBacktraceDetails, ) -> &mut Self

Whether wasm backtraces carry DWARF file/line detail. Defaults to WasmBacktraceDetails::Environment.

Source

pub fn debug_info(&mut self, enable: bool) -> &mut Self

Whether to retain the module’s DWARF debug info. Off by default. The native-debugger aspect is a no-op for an interpreter, but the retained DWARF symbolicates backtraces (ARCHITECTURE §16), so enabling this gives source-level frames regardless of wasm_backtrace_details.

Source

pub fn gc_memory_threshold(&mut self, bytes: usize) -> &mut Self

Engine-wide GC-pressure high-water mark, in bytes.

Additive deviation from wasmtime — there is no analog in wasmtime::Config. When total committed GC bytes across all stores of the engine cross this value, the engine requests collection from its stores (checked at the fuel/epoch back-edge safe point). Defaults to ~80% of detected physical RAM if unset. See docs/ARCHITECTURE.md §14.

Source

pub fn collector(&mut self, collector: Collector) -> &mut Self

Source

pub fn async_support(&mut self, enable: bool) -> &mut Self

Enables async execution (Func::call_async, async host fns, yields). Off by default. Once enabled, the sync entry points reject this store.

Source

pub fn async_stack_size(&mut self, size: usize) -> &mut Self

Accepted for wasmtime API parity but a no-op for this interpreter: suspend/resume is just parking the Execution state machine (no native fiber stack to size — see ARCHITECTURE §2.4), so there is no async stack.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.