pub struct Config { /* private fields */ }Expand description
Configuration for an Engine.
Implementations§
Source§impl Config
impl Config
Sourcepub fn set_max_recursion_depth(&mut self, value: usize) -> &mut Self
pub fn set_max_recursion_depth(&mut self, value: usize) -> &mut Self
Sourcepub fn set_min_stack_height(&mut self, value: usize) -> &mut Self
pub fn set_min_stack_height(&mut self, value: usize) -> &mut Self
Sourcepub fn set_max_stack_height(&mut self, value: usize) -> &mut Self
pub fn set_max_stack_height(&mut self, value: usize) -> &mut Self
Sourcepub fn set_max_cached_stacks(&mut self, value: usize) -> &mut Self
pub fn set_max_cached_stacks(&mut self, value: usize) -> &mut Self
Sourcepub fn wasm_mutable_global(&mut self, enable: bool) -> &mut Self
Available on crate feature validate only.
pub fn wasm_mutable_global(&mut self, enable: bool) -> &mut Self
validate only.Sourcepub fn wasm_sign_extension(&mut self, enable: bool) -> &mut Self
Available on crate feature validate only.
pub fn wasm_sign_extension(&mut self, enable: bool) -> &mut Self
validate only.Sourcepub fn wasm_saturating_float_to_int(&mut self, enable: bool) -> &mut Self
Available on crate feature validate only.
pub fn wasm_saturating_float_to_int(&mut self, enable: bool) -> &mut Self
validate only.Enable or disable the saturating-float-to-int Wasm proposal for the Config.
§Note
Enabled by default.
Sourcepub fn wasm_multi_value(&mut self, enable: bool) -> &mut Self
Available on crate feature validate only.
pub fn wasm_multi_value(&mut self, enable: bool) -> &mut Self
validate only.Sourcepub fn wasm_multi_memory(&mut self, enable: bool) -> &mut Self
Available on crate feature validate only.
pub fn wasm_multi_memory(&mut self, enable: bool) -> &mut Self
validate only.Sourcepub fn wasm_bulk_memory(&mut self, enable: bool) -> &mut Self
Available on crate feature validate only.
pub fn wasm_bulk_memory(&mut self, enable: bool) -> &mut Self
validate only.Sourcepub fn wasm_reference_types(&mut self, enable: bool) -> &mut Self
Available on crate feature validate only.
pub fn wasm_reference_types(&mut self, enable: bool) -> &mut Self
validate only.Sourcepub fn wasm_tail_call(&mut self, enable: bool) -> &mut Self
Available on crate feature validate only.
pub fn wasm_tail_call(&mut self, enable: bool) -> &mut Self
validate only.Sourcepub fn wasm_extended_const(&mut self, enable: bool) -> &mut Self
Available on crate feature validate only.
pub fn wasm_extended_const(&mut self, enable: bool) -> &mut Self
validate only.Sourcepub fn wasm_custom_page_sizes(&mut self, enable: bool) -> &mut Self
Available on crate feature validate only.
pub fn wasm_custom_page_sizes(&mut self, enable: bool) -> &mut Self
validate only.Sourcepub fn wasm_memory64(&mut self, enable: bool) -> &mut Self
Available on crate features memory64 and validate only.
pub fn wasm_memory64(&mut self, enable: bool) -> &mut Self
memory64 and validate only.Sourcepub fn wasm_wide_arithmetic(&mut self, enable: bool) -> &mut Self
Available on crate feature validate only.
pub fn wasm_wide_arithmetic(&mut self, enable: bool) -> &mut Self
validate only.Enable or disable the wide-arithmetic Wasm proposal for the Config.
Disabled by default.
Sourcepub fn wasm_simd(&mut self, enable: bool) -> &mut Self
Available on crate features simd and validate only.
pub fn wasm_simd(&mut self, enable: bool) -> &mut Self
simd and validate only.Sourcepub fn wasm_relaxed_simd(&mut self, enable: bool) -> &mut Self
Available on crate features simd and validate only.
pub fn wasm_relaxed_simd(&mut self, enable: bool) -> &mut Self
simd and validate only.Enable or disable the relaxed-simd Wasm proposal for the Config.
Enabled by default.
Sourcepub fn floats(&mut self, enable: bool) -> &mut Self
Available on crate feature validate only.
pub fn floats(&mut self, enable: bool) -> &mut Self
validate only.Enable or disable Wasm floating point (f32 and f64) instructions and types.
Enabled by default.
Sourcepub fn consume_fuel(&mut self, enable: bool) -> &mut Self
pub fn consume_fuel(&mut self, enable: bool) -> &mut Self
Configures whether Wasmi will consume fuel during execution to either halt execution as desired.
§Note
This configuration can be used to make Wasmi instrument its internal bytecode
so that it consumes fuel as it executes. Once an execution runs out of fuel
a TrapCode::OutOfFuel trap is raised.
This way users can deterministically halt or yield the execution of WebAssembly code.
- Use
Store::set_fuelto set the remaining fuel of theStorebefore executing some code as theStorestart with no fuel. - Use
Caller::set_fuelto update the remaining fuel when executing host functions.
Disabled by default.
Sourcepub fn allow_start_fn(&mut self, allow: bool) -> &mut Self
pub fn allow_start_fn(&mut self, allow: bool) -> &mut Self
Configures whether Wasmi allows Wasm modules with start functions.
Enabled by default.
Sourcepub fn ignore_custom_sections(&mut self, enable: bool) -> &mut Self
pub fn ignore_custom_sections(&mut self, enable: bool) -> &mut Self
Configures whether Wasmi will ignore custom sections when parsing Wasm modules.
Default value: false
Sourcepub fn operator_cost(&mut self, cost: OperatorCost) -> &mut Self
pub fn operator_cost(&mut self, cost: OperatorCost) -> &mut Self
Configures the fuel cost of each WebAssembly operator.
This is only relevant when Config::consume_fuel is enabled.
Sourcepub fn fuel_cost(&mut self, cost: CustomFuelCosts) -> &mut Self
pub fn fuel_cost(&mut self, cost: CustomFuelCosts) -> &mut Self
Configures the dynamic fuel cost.
This affects the following areas:
- Lazy translation and validation of functions.
- For example if
CompilationMode::LazyorCompilationMode::LazyTranslationis used.
- For example if
- Copying bytes or values in the following Wasm operator executions:
memory.{grow,copy,fill,init}table.{grow,copy,fill,init}
This is only relevant when Config::consume_fuel is enabled.
Sourcepub fn compilation_mode(&mut self, mode: CompilationMode) -> &mut Self
pub fn compilation_mode(&mut self, mode: CompilationMode) -> &mut Self
Sets the CompilationMode used for the Engine.
By default CompilationMode::LazyTranslation is used.
Sourcepub fn enforced_limits(&mut self, limits: EnforcedLimits) -> &mut Self
pub fn enforced_limits(&mut self, limits: EnforcedLimits) -> &mut Self
Sets the EnforcedLimits enforced by the Engine for Wasm module parsing and compilation.
By default no limits are enforced.