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§
Sourcefn sub_type_at(&self, type_idx: u32) -> Option<&SubType>
fn sub_type_at(&self, type_idx: u32) -> Option<&SubType>
Type with given index
Sourcefn tag_type_arity(&self, at: u32) -> Option<(u32, u32)>
fn tag_type_arity(&self, at: u32) -> Option<(u32, u32)>
Arity (param and result counts) of tag with given index
Sourcefn type_index_of_function(&self, function_idx: u32) -> Option<u32>
fn type_index_of_function(&self, function_idx: u32) -> Option<u32>
Type index of function with given index
Sourcefn func_type_of_cont_type(&self, c: &ContType) -> Option<&FuncType>
fn func_type_of_cont_type(&self, c: &ContType) -> Option<&FuncType>
Function type for a given continuation type
Sourcefn sub_type_of_ref_type(&self, rt: &RefType) -> Option<&SubType>
fn sub_type_of_ref_type(&self, rt: &RefType) -> Option<&SubType>
Sub type for a given reference type
Sourcefn control_stack_height(&self) -> u32
fn control_stack_height(&self) -> u32
Current height of control stack