wasmedge_sdk::config

Struct 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}};
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 result = ConfigBuilder::new(common_options)
    .with_statistics_config(stat_options)
    .with_runtime_config(runtime_options)
    .build();
assert!(result.is_ok());
let config = result.unwrap();

Implementations§

Source§

impl Config

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§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 T
where 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 T
where T: Clone,

Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.