Enum wasmtime::Val [−][src]
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(u32)
A 32-bit float.
Note that the raw bits of the float are stored here, and you can use
f32::from_bits
to create an f32
value.
F64(u64)
A 64-bit float.
Note that the raw bits of the float are stored here, and you can use
f64::from_bits
to create an f64
value.
An externref
value which can hold opaque data to the Wasm instance
itself.
ExternRef(None)
is the null external reference, created by ref.null extern
in Wasm.
A first-class reference to a WebAssembly function.
FuncRef(None)
is the null function reference, created by ref.null func
in Wasm.
V128(u128)
A 128-bit number
Implementations
impl Val
[src]
pub fn null() -> Val
[src]
Returns a null externref
value.
pub fn ty(&self) -> ValType
[src]
Returns the corresponding ValType
for this Val
.
pub fn i32(&self) -> Option<i32>
[src]
Attempt to access the underlying value of this Val
, returning
None
if it is not the correct type.
pub fn unwrap_i32(&self) -> i32
[src]
Returns the underlying value of this Val
, 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 Val
, returning
None
if it is not the correct type.
pub fn unwrap_i64(&self) -> i64
[src]
Returns the underlying value of this Val
, 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 Val
, returning
None
if it is not the correct type.
pub fn unwrap_f32(&self) -> f32
[src]
Returns the underlying value of this Val
, 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 Val
, returning
None
if it is not the correct type.
pub fn unwrap_f64(&self) -> f64
[src]
Returns the underlying value of this Val
, panicking if it’s the
wrong type.
Panics
Panics if self
is not of the right type.
pub fn funcref(&self) -> Option<Option<&Func>>
[src]
Attempt to access the underlying value of this Val
, returning
None
if it is not the correct type.
pub fn unwrap_funcref(&self) -> Option<&Func>
[src]
Returns the underlying value of this Val
, 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 Val
, returning
None
if it is not the correct type.
pub fn unwrap_v128(&self) -> u128
[src]
Returns the underlying value of this Val
, panicking if it’s the
wrong type.
Panics
Panics if self
is not of the right type.
pub fn externref(&self) -> Option<Option<ExternRef>>
[src]
Attempt to access the underlying externref
value of this Val
.
If this is not an externref
, then None
is returned.
If this is a null externref
, then Some(None)
is returned.
If this is a non-null externref
, then Some(Some(..))
is returned.
pub fn unwrap_externref(&self) -> Option<ExternRef>
[src]
Returns the underlying externref
value of this Val
, panicking if it’s the
wrong type.
If this is a null externref
, then None
is returned.
If this is a non-null externref
, then Some(..)
is returned.
Panics
Panics if self
is not a (nullable) externref
.
Trait Implementations
impl Clone for Val
[src]
impl Debug for Val
[src]
impl From<ExternRef> for Val
[src]
impl From<Func> for Val
[src]
impl From<Option<ExternRef>> for Val
[src]
impl From<Option<Func>> for Val
[src]
impl From<f32> for Val
[src]
impl From<f64> for Val
[src]
impl From<i32> for Val
[src]
impl From<i64> for Val
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Val
impl !Send for Val
impl !Sync for Val
impl Unpin for Val
impl !UnwindSafe for Val
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,
pub 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> Pointable for T
[src]
pub const ALIGN: usize
[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
[src]
pub unsafe fn drop(ptr: usize)
[src]
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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.
pub 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>,