[−][src]Enum wasmer_types::Value
Possible runtime values that a WebAssembly module can either consume or produce.
Variants
I32(i32)
A 32-bit integer
I64(i64)
A 64-bit integer
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.
A first-class reference to a WebAssembly function.
V128(u128)
A 128-bit number
Implementations
impl<T> Value<T>
[src]
pub fn null() -> Self
[src]
Returns a null externref
value.
pub fn ty(&self) -> Type
[src]
Returns the corresponding Type
for this Value
.
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(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]
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]
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]
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]
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]
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]
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]
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]
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<&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) -> &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]
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]
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]
Attempt to access the underlying value of this Value
, returning
None
if it is not the correct type.
This will return Some
for both the ExternRef
and FuncRef
types.
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.
Trait Implementations
impl<T: Clone> Clone for Value<T>
[src]
impl<T> Debug for Value<T>
[src]
impl<T> From<ExternRef> for Value<T>
[src]
impl<T> From<f32> for Value<T>
[src]
impl<T> From<f64> for Value<T>
[src]
impl<T> From<i32> for Value<T>
[src]
impl<T> From<i64> for Value<T>
[src]
impl<T: PartialEq> PartialEq<Value<T>> for Value<T>
[src]
impl<T> StructuralPartialEq for Value<T>
[src]
impl<T> ToString 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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut Tⓘ
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,