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§

Checks if the host registration wasi option turns on or not.

Returns the number of the memory pages available.

Checks if the ImportExportMutGlobals option turns on or not.

Checks if the NonTrapFloatToIntConversions option turns on or not.

Checks if the SignExtensionOperators option turns on or not.

Checks if the MultiValue option turns on or not.

Checks if the BulkMemoryOperations option turns on or not.

Checks if the ReferenceTypes option turns on or not.

Checks if the SIMD option turns on or not.

Checks if the MultiMemories option turns on or not.

Checks if the Threads option turns on or not.

Checks if the TailCall option turns on or not.

Checks if the FunctionReferences option turns on or not.

Checks if the ForceInterpreter option turns on or not.

Returns the optimization level of AOT compiler.

Returns the output binary format of AOT compiler.

Checks if the dump IR option turns on or not.

Checks if the generic binary option of AOT compiler turns on or not.

Checks if the Interruptible option of AOT Compiler turns on or not.

Checks if the instruction counting option turns on or not.

Checks if the cost measuring option turns on or not.

Checks if the cost measuring option turns on or not.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.