#[non_exhaustive]pub struct ParserOptions {
pub validation: bool,
pub optimize: bool,
pub deduplicate_operands: bool,
pub threads: Option<usize>,
}Expand description
Parser optimization and lowering options.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.validation: boolWhether to validate modules while parsing. Enabled by default when the
validate feature is enabled.
Requires the validate feature to have any effect.
Disable this only for trusted input. Parsing without validation may produce a module that violates runtime assumptions.
optimize: boolWhether to enable some of the optimizations during lowering, such as bounded instruction selection.
deduplicate_operands: boolWhether to deduplicate immutable function operands while parsing.
threads: Option<usize>Number of threads to use for parallel parsing.
Requires the parallel feature. Ignored when the feature is disabled.
None: auto-detect based on available parallelismSome(1): force single-threadedSome(n): use up tonworkers
Implementations§
Source§impl ParserOptions
impl ParserOptions
Sourcepub const fn with_validation(self, enabled: bool) -> Self
pub const fn with_validation(self, enabled: bool) -> Self
Enable or disable WebAssembly validation.
Requires the validate feature to have any effect.
Disable this only for trusted input. Parsing without validation may produce a module that violates runtime assumptions.
Sourcepub const fn validation(&self) -> bool
pub const fn validation(&self) -> bool
Returns whether WebAssembly validation is enabled.
Sourcepub const fn with_optimize(self, enabled: bool) -> Self
pub const fn with_optimize(self, enabled: bool) -> Self
Enable or disable some of the optimizations during lowering, such as bounded instruction selection.
Sourcepub const fn optimize(&self) -> bool
pub const fn optimize(&self) -> bool
Returns whether some of the optimizations during lowering, such as bounded instruction selection, are enabled.
Sourcepub const fn with_operand_deduplication(self, enabled: bool) -> Self
pub const fn with_operand_deduplication(self, enabled: bool) -> Self
Enable or disable parse-time deduplication of immutable function operands.
Sourcepub const fn deduplicate_operands(&self) -> bool
pub const fn deduplicate_operands(&self) -> bool
Returns whether immutable function operands are deduplicated while parsing.
Sourcepub const fn with_threads(self, threads: usize) -> Self
pub const fn with_threads(self, threads: usize) -> Self
Set the number of threads for parallel parsing.
Requires the parallel feature to have any effect.
Trait Implementations§
Source§impl Clone for ParserOptions
impl Clone for ParserOptions
Source§fn clone(&self) -> ParserOptions
fn clone(&self) -> ParserOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more