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

source

pub fn wasi_enabled(&self) -> bool

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

source

pub fn max_memory_pages(&self) -> u32

Returns the number of the memory pages available.

source

pub fn mutable_globals_enabled(&self) -> bool

Checks if the ImportExportMutGlobals option turns on or not.

source

pub fn non_trap_conversions_enabled(&self) -> bool

Checks if the NonTrapFloatToIntConversions option turns on or not.

source

pub fn sign_extension_operators_enabled(&self) -> bool

Checks if the SignExtensionOperators option turns on or not.

source

pub fn multi_value_enabled(&self) -> bool

Checks if the MultiValue option turns on or not.

source

pub fn bulk_memory_operations_enabled(&self) -> bool

Checks if the BulkMemoryOperations option turns on or not.

source

pub fn reference_types_enabled(&self) -> bool

Checks if the ReferenceTypes option turns on or not.

source

pub fn simd_enabled(&self) -> bool

Checks if the SIMD option turns on or not.

source

pub fn multi_memories_enabled(&self) -> bool

Checks if the MultiMemories option turns on or not.

source

pub fn threads_enabled(&self) -> bool

Checks if the Threads option turns on or not.

source

pub fn tail_call_enabled(&self) -> bool

Checks if the TailCall option turns on or not.

source

pub fn function_references_enabled(&self) -> bool

Checks if the FunctionReferences option turns on or not.

source

pub fn interpreter_mode_enabled(&self) -> bool

Checks if the ForceInterpreter option turns on or not.

source

pub fn optimization_level(&self) -> CompilerOptimizationLevel

Available on crate feature aot only.

Returns the optimization level of AOT compiler.

source

pub fn out_format(&self) -> CompilerOutputFormat

Available on crate feature aot only.

Returns the output binary format of AOT compiler.

source

pub fn dump_ir_enabled(&self) -> bool

Available on crate feature aot only.

Checks if the dump IR option turns on or not.

source

pub fn generic_binary_enabled(&self) -> bool

Available on crate feature aot only.

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

source

pub fn interruptible_enabled(&self) -> bool

Available on crate feature aot only.

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

source

pub fn instruction_counting_enabled(&self) -> bool

Checks if the instruction counting option turns on or not.

source

pub fn cost_measuring_enabled(&self) -> bool

Checks if the cost measuring option turns on or not.

source

pub fn time_measuring_enabled(&self) -> bool

Checks if the cost measuring option turns on or not.

Trait Implementations§

source§

impl Clone for Config

source§

fn clone(&self) -> Config

Returns a copy of the value. Read more
1.0.0 · 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

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V