Struct wasmedge_sys::WasmValue

source ·
pub struct WasmValue { /* private fields */ }
Expand description

Defines a WebAssembly value.

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) -> Self

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) -> Self

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) -> Self

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) -> Self

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) -> Self

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) -> Self

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) -> Self

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) -> Self

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

source§

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

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

impl From<WasmEdge_Value> for WasmValue

source§

fn from(raw_val: WasmEdge_Value) -> Self

Converts to this type from the input type.
source§

impl Copy for WasmValue

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