Struct wasmedge_sdk::config::Config
source · pub struct Config { /* private fields */ }
Expand description
Defines Config struct used to check/set the configuration options.
Example
The following code shows how to create a Config with ConfigBuilder.
use wasmedge_sdk::{config::{Config, ConfigBuilder, CommonConfigOptions, StatisticsConfigOptions, RuntimeConfigOptions, HostRegistrationConfigOptions}};
use wasmedge_types::{CompilerOutputFormat, CompilerOptimizationLevel};
let common_options = CommonConfigOptions::default()
.bulk_memory_operations(true)
.multi_value(true)
.mutable_globals(true)
.non_trap_conversions(true)
.reference_types(true)
.sign_extension_operators(true)
.simd(true);
let stat_options = StatisticsConfigOptions::default()
.count_instructions(true)
.measure_cost(true)
.measure_time(true);
let runtime_options = RuntimeConfigOptions::default().max_memory_pages(1024);
let host_options = HostRegistrationConfigOptions::default()
.wasi(true);
let result = ConfigBuilder::new(common_options)
.with_statistics_config(stat_options)
.with_runtime_config(runtime_options)
.with_host_registration_config(host_options)
.build();
assert!(result.is_ok());
let config = result.unwrap();
Implementations§
source§impl Config
impl Config
sourcepub fn wasi_enabled(&self) -> bool
pub fn wasi_enabled(&self) -> bool
Checks if the host registration wasi option turns on or not.
sourcepub fn max_memory_pages(&self) -> u32
pub fn max_memory_pages(&self) -> u32
Returns the number of the memory pages available.
sourcepub fn mutable_globals_enabled(&self) -> bool
pub fn mutable_globals_enabled(&self) -> bool
Checks if the ImportExportMutGlobals option turns on or not.
sourcepub fn non_trap_conversions_enabled(&self) -> bool
pub fn non_trap_conversions_enabled(&self) -> bool
Checks if the NonTrapFloatToIntConversions option turns on or not.
sourcepub fn sign_extension_operators_enabled(&self) -> bool
pub fn sign_extension_operators_enabled(&self) -> bool
Checks if the SignExtensionOperators option turns on or not.
sourcepub fn multi_value_enabled(&self) -> bool
pub fn multi_value_enabled(&self) -> bool
Checks if the MultiValue option turns on or not.
sourcepub fn bulk_memory_operations_enabled(&self) -> bool
pub fn bulk_memory_operations_enabled(&self) -> bool
Checks if the BulkMemoryOperations option turns on or not.
sourcepub fn reference_types_enabled(&self) -> bool
pub fn reference_types_enabled(&self) -> bool
Checks if the ReferenceTypes option turns on or not.
sourcepub fn simd_enabled(&self) -> bool
pub fn simd_enabled(&self) -> bool
Checks if the SIMD option turns on or not.
sourcepub fn multi_memories_enabled(&self) -> bool
pub fn multi_memories_enabled(&self) -> bool
Checks if the MultiMemories option turns on or not.
sourcepub fn threads_enabled(&self) -> bool
pub fn threads_enabled(&self) -> bool
Checks if the Threads option turns on or not.
sourcepub fn tail_call_enabled(&self) -> bool
pub fn tail_call_enabled(&self) -> bool
Checks if the TailCall option turns on or not.
sourcepub fn function_references_enabled(&self) -> bool
pub fn function_references_enabled(&self) -> bool
Checks if the FunctionReferences option turns on or not.
sourcepub fn interpreter_mode_enabled(&self) -> bool
pub fn interpreter_mode_enabled(&self) -> bool
Checks if the ForceInterpreter
option turns on or not.
sourcepub fn optimization_level(&self) -> CompilerOptimizationLevel
Available on crate feature aot
only.
pub fn optimization_level(&self) -> CompilerOptimizationLevel
aot
only.Returns the optimization level of AOT compiler.
sourcepub fn out_format(&self) -> CompilerOutputFormat
Available on crate feature aot
only.
pub fn out_format(&self) -> CompilerOutputFormat
aot
only.Returns the output binary format of AOT compiler.
sourcepub fn dump_ir_enabled(&self) -> bool
Available on crate feature aot
only.
pub fn dump_ir_enabled(&self) -> bool
aot
only.Checks if the dump IR option turns on or not.
sourcepub fn generic_binary_enabled(&self) -> bool
Available on crate feature aot
only.
pub fn generic_binary_enabled(&self) -> bool
aot
only.Checks if the generic binary option of AOT compiler turns on or not.
sourcepub fn interruptible_enabled(&self) -> bool
Available on crate feature aot
only.
pub fn interruptible_enabled(&self) -> bool
aot
only.Checks if the Interruptible
option of AOT Compiler turns on or not.
sourcepub fn instruction_counting_enabled(&self) -> bool
pub fn instruction_counting_enabled(&self) -> bool
Checks if the instruction counting option turns on or not.
sourcepub fn cost_measuring_enabled(&self) -> bool
pub fn cost_measuring_enabled(&self) -> bool
Checks if the cost measuring option turns on or not.
sourcepub fn time_measuring_enabled(&self) -> bool
pub fn time_measuring_enabled(&self) -> bool
Checks if the cost measuring option turns on or not.