Struct wasm_encoder::ConstExpr
source · pub struct ConstExpr { /* private fields */ }
Expand description
A constant expression.
Usable in contexts such as offsets or initializers.
Implementations§
source§impl ConstExpr
impl ConstExpr
sourcepub fn raw(bytes: impl IntoIterator<Item = u8>) -> Self
pub fn raw(bytes: impl IntoIterator<Item = u8>) -> Self
Create a constant expression with the specified raw encoding of instructions.
sourcepub fn global_get(index: u32) -> Self
pub fn global_get(index: u32) -> Self
Create a constant expression containing a single global.get
instruction.
sourcepub fn ref_null(ty: ValType) -> Self
pub fn ref_null(ty: ValType) -> Self
Create a constant expression containing a single ref.null
instruction.
sourcepub fn ref_func(func: u32) -> Self
pub fn ref_func(func: u32) -> Self
Create a constant expression containing a single ref.func
instruction.
sourcepub fn i32_const(value: i32) -> Self
pub fn i32_const(value: i32) -> Self
Create a constant expression containing a single i32.const
instruction.
sourcepub fn i64_const(value: i64) -> Self
pub fn i64_const(value: i64) -> Self
Create a constant expression containing a single i64.const
instruction.
sourcepub fn f32_const(value: f32) -> Self
pub fn f32_const(value: f32) -> Self
Create a constant expression containing a single f32.const
instruction.
sourcepub fn f64_const(value: f64) -> Self
pub fn f64_const(value: f64) -> Self
Create a constant expression containing a single f64.const
instruction.
sourcepub fn v128_const(value: i128) -> Self
pub fn v128_const(value: i128) -> Self
Create a constant expression containing a single v128.const
instruction.