Trait wasmparser::ModuleArity

source ·
pub trait ModuleArity {
    // Required methods
    fn sub_type_at(&self, type_idx: u32) -> Option<&SubType>;
    fn tag_type_arity(&self, at: u32) -> Option<(u32, u32)>;
    fn type_index_of_function(&self, function_idx: u32) -> Option<u32>;
    fn func_type_of_cont_type(&self, c: &ContType) -> Option<&FuncType>;
    fn sub_type_of_ref_type(&self, rt: &RefType) -> Option<&SubType>;
    fn control_stack_height(&self) -> u32;
    fn label_block(&self, depth: u32) -> Option<(BlockType, FrameKind)>;

    // Provided methods
    fn sub_type_arity(&self, t: &SubType) -> Option<(u32, u32)> { ... }
    fn block_type_arity(&self, ty: BlockType) -> Option<(u32, u32)> { ... }
}
Expand description

To compute the arity (param and result counts) of “variable-arity” operators, the operator_arity macro needs information about the module’s types and the current control stack. The ModuleArity trait exposes this information.

Required Methods§

source

fn sub_type_at(&self, type_idx: u32) -> Option<&SubType>

Type with given index

source

fn tag_type_arity(&self, at: u32) -> Option<(u32, u32)>

Arity (param and result counts) of tag with given index

source

fn type_index_of_function(&self, function_idx: u32) -> Option<u32>

Type index of function with given index

source

fn func_type_of_cont_type(&self, c: &ContType) -> Option<&FuncType>

Function type for a given continuation type

source

fn sub_type_of_ref_type(&self, rt: &RefType) -> Option<&SubType>

Sub type for a given reference type

source

fn control_stack_height(&self) -> u32

Current height of control stack

source

fn label_block(&self, depth: u32) -> Option<(BlockType, FrameKind)>

BlockType and FrameKind of label with given index

Provided Methods§

source

fn sub_type_arity(&self, t: &SubType) -> Option<(u32, u32)>

Computes arity of given SubType

source

fn block_type_arity(&self, ty: BlockType) -> Option<(u32, u32)>

Computes arity of given BlockType

Implementors§