pub enum Val {
I32(i32),
I64(i64),
F32(F32),
F64(F64),
V128(V128),
FuncRef(Ref<Func>),
ExternRef(Ref<ExternRef>),
}Expand description
Runtime representation of a Wasm value.
Wasm code manipulate values of the four basic value types: integers and floating-point (IEEE 754-2008) data of 32 or 64 bit width each, respectively.
There is no distinction between signed and unsigned integer types. Instead, integers are interpreted by respective operations as either unsigned or signed in two’s complement representation.
Variants§
I32(i32)
Value of 32-bit signed or unsigned integer.
I64(i64)
Value of 64-bit signed or unsigned integer.
F32(F32)
Value of 32-bit IEEE 754-2008 floating point number.
F64(F64)
Value of 64-bit IEEE 754-2008 floating point number.
V128(V128)
128-bit Wasm simd proposal vector.
FuncRef(Ref<Func>)
A nullable Func reference.
ExternRef(Ref<ExternRef>)
A nullable ExternRef reference.
Implementations§
Source§impl Val
impl Val
Sourcepub fn i32(&self) -> Option<i32>
pub fn i32(&self) -> Option<i32>
Returns the underlying i32 if the type matches otherwise returns None.
Sourcepub fn i64(&self) -> Option<i64>
pub fn i64(&self) -> Option<i64>
Returns the underlying i64 if the type matches otherwise returns None.
Sourcepub fn f32(&self) -> Option<F32>
pub fn f32(&self) -> Option<F32>
Returns the underlying f32 if the type matches otherwise returns None.
Sourcepub fn f64(&self) -> Option<F64>
pub fn f64(&self) -> Option<F64>
Returns the underlying f64 if the type matches otherwise returns None.