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

source

pub fn empty() -> Self

Create a new empty constant expression builder.

source

pub fn raw(bytes: impl IntoIterator<Item = u8>) -> Self

Create a constant expression with the specified raw encoding of instructions.

source

pub fn global_get(index: u32) -> Self

Create a constant expression containing a single global.get instruction.

source

pub fn ref_null(ty: HeapType) -> Self

Create a constant expression containing a single ref.null instruction.

source

pub fn ref_func(func: u32) -> Self

Create a constant expression containing a single ref.func instruction.

source

pub fn i32_const(value: i32) -> Self

Create a constant expression containing a single i32.const instruction.

source

pub fn i64_const(value: i64) -> Self

Create a constant expression containing a single i64.const instruction.

source

pub fn f32_const(value: f32) -> Self

Create a constant expression containing a single f32.const instruction.

source

pub fn f64_const(value: f64) -> Self

Create a constant expression containing a single f64.const instruction.

source

pub fn v128_const(value: i128) -> Self

Create a constant expression containing a single v128.const instruction.

Trait Implementations§

source§

impl Debug for ConstExpr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Encode for ConstExpr

source§

fn encode(&self, sink: &mut Vec<u8>)

Encode the type into the given byte sink.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.