[][src]Struct walrus::BlockBuilder

pub struct BlockBuilder<'a> { /* fields omitted */ }

A builder returned by block-construction methods to build up block expressions over time.

Methods

impl<'_> BlockBuilder<'_>[src]

pub fn expr(&mut self, expr: ExprId)[src]

Pushes a new expression to be executed in the block we're building

pub fn id(&self) -> BlockId[src]

Returns the id of the block that we're building

Methods from Deref<Target = FunctionBuilder>

pub fn block<'a>(
    &'a mut self,
    params: Box<[ValType]>,
    results: Box<[ValType]>
) -> BlockBuilder<'a>
[src]

Create a Block node with the kind of Block.

Note that instructions aren't passed here, but rather added to the returned BlockBuilder via the expr method.

Examples

use walrus::FunctionBuilder;

let mut builder = FunctionBuilder::new();
let block = {
    let mut block = builder.block(Box::new([]), Box::new([]));
    let id = block.id();
    let br = block.br(id, Box::new([]));
    block.expr(br);
    id
}; // when `block` is `Drop`'d it'll fill in the node's expressions

// ...

pub fn loop_<'a>(&'a mut self, results: Box<[ValType]>) -> BlockBuilder<'a>[src]

Create a Block node with the kind of Loop

pub fn if_else_block<'a>(
    &'a mut self,
    params: Box<[ValType]>,
    results: Box<[ValType]>
) -> BlockBuilder<'a>
[src]

Create a Block node with the kind of IfElse

pub fn i32_const(&mut self, val: i32) -> ExprId[src]

Creates an i32.const instruction for the specified value

pub fn i64_const(&mut self, val: i64) -> ExprId[src]

Creates an i64.const instruction for the specified value

pub fn f32_const(&mut self, val: f32) -> ExprId[src]

Creates an f32.const instruction for the specified value

pub fn f64_const(&mut self, val: f64) -> ExprId[src]

Creates an f64.const instruction for the specified value

pub fn call(&mut self, func: FunctionId, args: Box<[ExprId]>) -> ExprId[src]

pub fn call_indirect(
    &mut self,
    ty: TypeId,
    table: TableId,
    func: ExprId,
    args: Box<[ExprId]>
) -> ExprId
[src]

pub fn local_get(&mut self, local: LocalId) -> ExprId[src]

pub fn local_set(&mut self, local: LocalId, value: ExprId) -> ExprId[src]

pub fn local_tee(&mut self, local: LocalId, value: ExprId) -> ExprId[src]

pub fn global_get(&mut self, global: GlobalId) -> ExprId[src]

pub fn global_set(&mut self, global: GlobalId, value: ExprId) -> ExprId[src]

pub fn const_(&mut self, value: Value) -> ExprId[src]

pub fn binop(&mut self, op: BinaryOp, lhs: ExprId, rhs: ExprId) -> ExprId[src]

pub fn unop(&mut self, op: UnaryOp, expr: ExprId) -> ExprId[src]

pub fn select(
    &mut self,
    condition: ExprId,
    consequent: ExprId,
    alternative: ExprId
) -> ExprId
[src]

pub fn unreachable(&mut self) -> ExprId[src]

pub fn br(&mut self, block: BlockId, args: Box<[ExprId]>) -> ExprId[src]

pub fn br_if(
    &mut self,
    condition: ExprId,
    block: BlockId,
    args: Box<[ExprId]>
) -> ExprId
[src]

pub fn if_else(
    &mut self,
    condition: ExprId,
    consequent: BlockId,
    alternative: BlockId
) -> ExprId
[src]

pub fn br_table(
    &mut self,
    which: ExprId,
    blocks: Box<[BlockId]>,
    default: BlockId,
    args: Box<[ExprId]>
) -> ExprId
[src]

pub fn drop(&mut self, expr: ExprId) -> ExprId[src]

pub fn return_(&mut self, values: Box<[ExprId]>) -> ExprId[src]

pub fn memory_size(&mut self, memory: MemoryId) -> ExprId[src]

pub fn memory_grow(&mut self, memory: MemoryId, pages: ExprId) -> ExprId[src]

pub fn memory_init(
    &mut self,
    memory: MemoryId,
    data: DataId,
    memory_offset: ExprId,
    data_offset: ExprId,
    len: ExprId
) -> ExprId
[src]

pub fn data_drop(&mut self, data: DataId) -> ExprId[src]

pub fn memory_copy(
    &mut self,
    src: MemoryId,
    dst: MemoryId,
    dst_offset: ExprId,
    src_offset: ExprId,
    len: ExprId
) -> ExprId
[src]

pub fn memory_fill(
    &mut self,
    memory: MemoryId,
    offset: ExprId,
    value: ExprId,
    len: ExprId
) -> ExprId
[src]

pub fn load(
    &mut self,
    memory: MemoryId,
    kind: LoadKind,
    arg: MemArg,
    address: ExprId
) -> ExprId
[src]

pub fn store(
    &mut self,
    memory: MemoryId,
    kind: StoreKind,
    arg: MemArg,
    address: ExprId,
    value: ExprId
) -> ExprId
[src]

pub fn atomic_rmw(
    &mut self,
    memory: MemoryId,
    op: AtomicOp,
    width: AtomicWidth,
    arg: MemArg,
    address: ExprId,
    value: ExprId
) -> ExprId
[src]

pub fn cmpxchg(
    &mut self,
    memory: MemoryId,
    width: AtomicWidth,
    arg: MemArg,
    address: ExprId,
    expected: ExprId,
    replacement: ExprId
) -> ExprId
[src]

pub fn atomic_notify(
    &mut self,
    memory: MemoryId,
    arg: MemArg,
    address: ExprId,
    count: ExprId
) -> ExprId
[src]

pub fn atomic_wait(
    &mut self,
    memory: MemoryId,
    arg: MemArg,
    address: ExprId,
    expected: ExprId,
    timeout: ExprId,
    sixty_four: bool
) -> ExprId
[src]

pub fn with_side_effects(
    &mut self,
    before: Vec<ExprId>,
    value: ExprId,
    after: Vec<ExprId>
) -> ExprId
[src]

pub fn table_get(&mut self, table: TableId, index: ExprId) -> ExprId[src]

pub fn table_set(
    &mut self,
    table: TableId,
    index: ExprId,
    value: ExprId
) -> ExprId
[src]

pub fn table_grow(
    &mut self,
    table: TableId,
    amount: ExprId,
    value: ExprId
) -> ExprId
[src]

pub fn table_size(&mut self, table: TableId) -> ExprId[src]

pub fn ref_null(&mut self) -> ExprId[src]

pub fn ref_is_null(&mut self, value: ExprId) -> ExprId[src]

Trait Implementations

impl<'_> Drop for BlockBuilder<'_>[src]

impl<'_> DerefMut for BlockBuilder<'_>[src]

impl<'a> Debug for BlockBuilder<'a>[src]

impl<'_> Deref for BlockBuilder<'_>[src]

type Target = FunctionBuilder

The resulting type after dereferencing.

Auto Trait Implementations

impl<'a> Send for BlockBuilder<'a>

impl<'a> Sync for BlockBuilder<'a>

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.