Type Alias wasmedge_sdk::WasmValue

source ·
pub type WasmValue = WasmValue;
Expand description

WebAssembly value type.

Aliased Type§

struct WasmValue { /* private fields */ }

Implementations

source§

impl WasmValue

source

pub fn as_raw(&self) -> WasmEdge_Value

Returns the raw WasmEdge_Value.

source

pub fn ty(&self) -> ValType

Returns the type of a WasmValue.

source

pub fn from_i32(val: i32) -> WasmValue

Creates a WasmValue from a i32 value.

Argument
  • val - The source i32 value.
source

pub fn to_i32(&self) -> i32

Generates a i32 value from a WasmValue.

source

pub fn from_i64(val: i64) -> WasmValue

Creates a WasmValue from a i64 value.

Argument
  • val - The source i64 value.
source

pub fn to_i64(&self) -> i64

Generates a i64 value from a WasmValue.

source

pub fn from_f32(val: f32) -> WasmValue

Creates a WasmValue from a f32 value.

Argument
  • val - The source f32 value.
source

pub fn to_f32(&self) -> f32

Generates a f32 value from a WasmValue.

source

pub fn from_f64(val: f64) -> WasmValue

Creates a WasmValue from a f64 value.

Argument
  • val - The source f64 value.
source

pub fn to_f64(&self) -> f64

Generates a f64 value from a WasmValue.

source

pub fn from_v128(val: i128) -> WasmValue

Creates a WasmValue from a i128 value.

Argument
  • val - The source i128 value.
source

pub fn to_v128(&self) -> i128

Generates a v128 value from a WasmValue.

source

pub fn from_null_ref(ref_ty: RefType) -> WasmValue

Creates a WasmValue from a RefType value.

Argument
  • val - The [RefType`] value.
source

pub fn is_null_ref(&self) -> bool

Checks if a WasmValue is NullRef or not.

source

pub fn from_func_ref(func_ref: FuncRef) -> WasmValue

Creates a WasmValue from a FuncRef.

Notice that the WasmValues generated from FuncRefs are only meaningful when the bulk_memory_operations or reference_types option is enabled in the Config.

Argument
source

pub fn func_ref(&self) -> Option<FuncRef>

Returns the FuncRef(crate::FuncRef).

If the WasmValue is a NullRef, then None is returned.

source

pub fn from_extern_ref<T>(extern_obj: &mut T) -> WasmValue

Creates a WasmValue from a reference to an external object.

The WasmValues generated by this function are only meaningful when the reference_types option is enabled in the Config.

Argument
  • extern_obj - The reference to an external object.
source

pub fn extern_ref<T>(&self) -> Option<&T>

Returns the reference to an external object.

If the WasmValue is a NullRef, then None is returned.

Trait Implementations

source§

impl Clone for WasmValue

source§

fn clone(&self) -> WasmValue

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 Copy for WasmValue

source§

impl From<WasmEdge_Value> for WasmValue

source§

fn from(raw_val: WasmEdge_Value) -> WasmValue

Converts to this type from the input type.
source§

impl Debug for WasmValue

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl From<Val> for WasmValue

source§

fn from(val: Val) -> Self

Converts to this type from the input type.