[][src]Struct walrus::FunctionBuilder

pub struct FunctionBuilder { /* fields omitted */ }

A helpful struct used for building instances of LocalFunction

Methods

impl FunctionBuilder[src]

pub fn new() -> FunctionBuilder[src]

Creates a new blank builder ready to build a function.

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 finish(
    self,
    ty_id: TypeId,
    args: Vec<LocalId>,
    exprs: Vec<ExprId>,
    module: &mut Module
) -> FunctionId
[src]

Finishes this builder, wrapping it all up and inserting it into the specified Module.

impl FunctionBuilder[src]

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,
    value: ExprId,
    side_effects: Vec<ExprId>
) -> ExprId
[src]

Trait Implementations

impl Default for FunctionBuilder[src]

impl Debug for FunctionBuilder[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> From for 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> 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.

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