wasmedge_sys

Struct 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 is_null_ref(&self) -> bool

Checks if a WasmValue is NullRef or not.

Source

pub fn from_func_ref<Func: AsFunc>(func_ref: &Func) -> 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<&Self>>

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

Creates a null WasmValue with a ExternRef.

§Argument
  • val - The [RefType`] value.
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 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.