Enum wasmer_types::Value [−][src]
pub enum Value<T> { I32(i32), I64(i64), F32(f32), F64(f64), ExternRef(ExternRef), FuncRef(Option<T>), V128(u128), }
Expand description
Possible runtime values that a WebAssembly module can either consume or produce.
Variants
I32(i32)
A 32-bit integer.
In Wasm integers are sign-agnostic, i.e. this can either be signed or unsigned.
I64(i64)
A 64-bit integer.
In Wasm integers are sign-agnostic, i.e. this can either be signed or unsigned.
F32(f32)
A 32-bit float.
F64(f64)
A 64-bit float.
ExternRef(ExternRef)
An externref
value which can hold opaque data to the wasm instance itself.
Note that this is a nullable value as well.
FuncRef(Option<T>)
A first-class reference to a WebAssembly function.
V128(u128)
A 128-bit number
Implementations
impl<T> Value<T> where
T: WasmValueType,
[src]
impl<T> Value<T> where
T: WasmValueType,
[src]pub unsafe fn write_value_to(&self, p: *mut i128)
[src]
pub unsafe fn write_value_to(&self, p: *mut i128)
[src]Writes it’s value to a given pointer
Safety
p
must be:
- Sufficiently aligned for the Rust equivalent of the type in
self
- Non-null and pointing to valid, mutable memory
pub unsafe fn read_value_from(store: &dyn Any, p: *const i128, ty: Type) -> Self
[src]
pub unsafe fn read_value_from(store: &dyn Any, p: *const i128, ty: Type) -> Self
[src]Gets a Value
given a pointer and a Type
Safety
p
must be:
- Properly aligned to the specified
ty
’s Rust equivalent - Non-null and pointing to valid memory
pub fn i32(&self) -> Option<i32>
[src]
pub fn i32(&self) -> Option<i32>
[src]Attempt to access the underlying value of this Value
, returning
None
if it is not the correct type.
pub fn unwrap_i32(&self) -> i32
[src]
pub fn unwrap_i32(&self) -> i32
[src]Returns the underlying value of this Value
, panicking if it’s the
wrong type.
Panics
Panics if self
is not of the right type.
pub fn i64(&self) -> Option<i64>
[src]
pub fn i64(&self) -> Option<i64>
[src]Attempt to access the underlying value of this Value
, returning
None
if it is not the correct type.
pub fn unwrap_i64(&self) -> i64
[src]
pub fn unwrap_i64(&self) -> i64
[src]Returns the underlying value of this Value
, panicking if it’s the
wrong type.
Panics
Panics if self
is not of the right type.
pub fn f32(&self) -> Option<f32>
[src]
pub fn f32(&self) -> Option<f32>
[src]Attempt to access the underlying value of this Value
, returning
None
if it is not the correct type.
pub fn unwrap_f32(&self) -> f32
[src]
pub fn unwrap_f32(&self) -> f32
[src]Returns the underlying value of this Value
, panicking if it’s the
wrong type.
Panics
Panics if self
is not of the right type.
pub fn f64(&self) -> Option<f64>
[src]
pub fn f64(&self) -> Option<f64>
[src]Attempt to access the underlying value of this Value
, returning
None
if it is not the correct type.
pub fn unwrap_f64(&self) -> f64
[src]
pub fn unwrap_f64(&self) -> f64
[src]Returns the underlying value of this Value
, panicking if it’s the
wrong type.
Panics
Panics if self
is not of the right type.
pub fn externref(&self) -> Option<ExternRef>
[src]
pub fn externref(&self) -> Option<ExternRef>
[src]Attempt to access the underlying value of this Value
, returning
None
if it is not the correct type.
pub fn unwrap_externref(&self) -> ExternRef
[src]
pub fn unwrap_externref(&self) -> ExternRef
[src]Returns the underlying value of this Value
, panicking if it’s the
wrong type.
Panics
Panics if self
is not of the right type.
pub fn funcref(&self) -> Option<&Option<T>>
[src]
pub fn funcref(&self) -> Option<&Option<T>>
[src]Attempt to access the underlying value of this Value
, returning
None
if it is not the correct type.
pub fn unwrap_funcref(&self) -> &Option<T>
[src]
pub fn unwrap_funcref(&self) -> &Option<T>
[src]Returns the underlying value of this Value
, panicking if it’s the
wrong type.
Panics
Panics if self
is not of the right type.
pub fn v128(&self) -> Option<u128>
[src]
pub fn v128(&self) -> Option<u128>
[src]Attempt to access the underlying value of this Value
, returning
None
if it is not the correct type.
pub fn unwrap_v128(&self) -> u128
[src]
pub fn unwrap_v128(&self) -> u128
[src]Returns the underlying value of this Value
, panicking if it’s the
wrong type.
Panics
Panics if self
is not of the right type.
Trait Implementations
impl<T> Debug for Value<T> where
T: WasmValueType,
[src]
impl<T> Debug for Value<T> where
T: WasmValueType,
[src]impl<T> From<ExternRef> for Value<T> where
T: WasmValueType,
[src]
impl<T> From<ExternRef> for Value<T> where
T: WasmValueType,
[src]impl<T> From<f32> for Value<T> where
T: WasmValueType,
[src]
impl<T> From<f32> for Value<T> where
T: WasmValueType,
[src]impl<T> From<f64> for Value<T> where
T: WasmValueType,
[src]
impl<T> From<f64> for Value<T> where
T: WasmValueType,
[src]impl<T> From<i32> for Value<T> where
T: WasmValueType,
[src]
impl<T> From<i32> for Value<T> where
T: WasmValueType,
[src]impl<T> From<i64> for Value<T> where
T: WasmValueType,
[src]
impl<T> From<i64> for Value<T> where
T: WasmValueType,
[src]impl<T> From<u32> for Value<T> where
T: WasmValueType,
[src]
impl<T> From<u32> for Value<T> where
T: WasmValueType,
[src]impl<T> From<u64> for Value<T> where
T: WasmValueType,
[src]
impl<T> From<u64> for Value<T> where
T: WasmValueType,
[src]impl<T> ToString for Value<T> where
T: WasmValueType,
[src]
impl<T> ToString for Value<T> where
T: WasmValueType,
[src]impl<T> TryFrom<Value<T>> for i32 where
T: WasmValueType,
[src]
impl<T> TryFrom<Value<T>> for i32 where
T: WasmValueType,
[src]impl<T> TryFrom<Value<T>> for u32 where
T: WasmValueType,
[src]
impl<T> TryFrom<Value<T>> for u32 where
T: WasmValueType,
[src]impl<T> TryFrom<Value<T>> for i64 where
T: WasmValueType,
[src]
impl<T> TryFrom<Value<T>> for i64 where
T: WasmValueType,
[src]impl<T> TryFrom<Value<T>> for u64 where
T: WasmValueType,
[src]
impl<T> TryFrom<Value<T>> for u64 where
T: WasmValueType,
[src]impl<T> TryFrom<Value<T>> for f32 where
T: WasmValueType,
[src]
impl<T> TryFrom<Value<T>> for f32 where
T: WasmValueType,
[src]impl<T> TryFrom<Value<T>> for f64 where
T: WasmValueType,
[src]
impl<T> TryFrom<Value<T>> for f64 where
T: WasmValueType,
[src]impl<T> StructuralPartialEq for Value<T>
[src]
Auto Trait Implementations
impl<T> !RefUnwindSafe for Value<T>
impl<T> !Send for Value<T>
impl<T> !Sync for Value<T>
impl<T> Unpin for Value<T> where
T: Unpin,
T: Unpin,
impl<T> !UnwindSafe for Value<T>
Blanket Implementations
impl<T> ArchivePointee for T
[src]
impl<T> ArchivePointee for T
[src]type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
pub fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
[src]
pub fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
[src]Converts some archived metadata to the pointer metadata for itself.
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more