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 extended<'a>(insns: impl IntoIterator<Item = Instruction<'a>>) -> Self
pub fn extended<'a>(insns: impl IntoIterator<Item = Instruction<'a>>) -> Self
Create a constant expression with the sequence 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: HeapType) -> Self
pub fn ref_null(ty: HeapType) -> 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.
Sourcepub fn with_global_get(self, index: u32) -> Self
pub fn with_global_get(self, index: u32) -> Self
Add a global.get
instruction to this constant expression.
Sourcepub fn with_ref_null(self, ty: HeapType) -> Self
pub fn with_ref_null(self, ty: HeapType) -> Self
Add a ref.null
instruction to this constant expression.
Sourcepub fn with_ref_func(self, func: u32) -> Self
pub fn with_ref_func(self, func: u32) -> Self
Add a ref.func
instruction to this constant expression.
Sourcepub fn with_i32_const(self, value: i32) -> Self
pub fn with_i32_const(self, value: i32) -> Self
Add an i32.const
instruction to this constant expression.
Sourcepub fn with_i64_const(self, value: i64) -> Self
pub fn with_i64_const(self, value: i64) -> Self
Add an i64.const
instruction to this constant expression.
Sourcepub fn with_f32_const(self, value: f32) -> Self
pub fn with_f32_const(self, value: f32) -> Self
Add a f32.const
instruction to this constant expression.
Sourcepub fn with_f64_const(self, value: f64) -> Self
pub fn with_f64_const(self, value: f64) -> Self
Add a f64.const
instruction to this constant expression.
Sourcepub fn with_v128_const(self, value: i128) -> Self
pub fn with_v128_const(self, value: i128) -> Self
Add a v128.const
instruction to this constant expression.
Sourcepub fn with_i32_add(self) -> Self
pub fn with_i32_add(self) -> Self
Add an i32.add
instruction to this constant expression.
Sourcepub fn with_i32_sub(self) -> Self
pub fn with_i32_sub(self) -> Self
Add an i32.sub
instruction to this constant expression.
Sourcepub fn with_i32_mul(self) -> Self
pub fn with_i32_mul(self) -> Self
Add an i32.mul
instruction to this constant expression.
Sourcepub fn with_i64_add(self) -> Self
pub fn with_i64_add(self) -> Self
Add an i64.add
instruction to this constant expression.
Sourcepub fn with_i64_sub(self) -> Self
pub fn with_i64_sub(self) -> Self
Add an i64.sub
instruction to this constant expression.
Sourcepub fn with_i64_mul(self) -> Self
pub fn with_i64_mul(self) -> Self
Add an i64.mul
instruction to this constant expression.
Sourcepub fn get_ref_func(&self) -> Option<u32>
pub fn get_ref_func(&self) -> Option<u32>
Returns the function, if any, referenced by this global.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConstExpr
impl RefUnwindSafe for ConstExpr
impl Send for ConstExpr
impl Sync for ConstExpr
impl Unpin for ConstExpr
impl UnwindSafe for ConstExpr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)