pub trait RunnableCode {
// Required methods
fn num_params(&self) -> u32;
fn num_registers(&self) -> u32;
fn constants(&self) -> &[i64];
fn type_idx(&self) -> TypeIndex;
fn return_type(&self) -> BlockType;
fn params(&self) -> &[ValueType];
fn num_locals(&self) -> u32;
fn locals(&self) -> LocalsIterator<'_> ⓘ;
fn code(&self) -> &[u8] ⓘ;
}Expand description
A trait encapsulating the properties that are needed to run a function.
This trait exists because we have two different kinds of code we run. A
fully deserialized code, i.e., where instructions are essentially
Vec<InternalOpcode> or we execute directly from &[u8] if the origin of
the code is a serialized structure, such as an Artifact retrieved from a
database.
Required Methods§
Sourcefn num_params(&self) -> u32
fn num_params(&self) -> u32
The number of parameters of the function.
Sourcefn num_registers(&self) -> u32
fn num_registers(&self) -> u32
The number of registers the function needs in the worst case. This includes locals and parameters.
Sourcefn constants(&self) -> &[i64]
fn constants(&self) -> &[i64]
The number of distinct constants that appear in the function body.
Sourcefn type_idx(&self) -> TypeIndex
fn type_idx(&self) -> TypeIndex
The type of the function, as an index into the list of types of the module.
Sourcefn return_type(&self) -> BlockType
fn return_type(&self) -> BlockType
The return type of the function.
Sourcefn num_locals(&self) -> u32
fn num_locals(&self) -> u32
The number of locals declared by the function. This does not include the function parameters, only declared locals.
Sourcefn locals(&self) -> LocalsIterator<'_> ⓘ
fn locals(&self) -> LocalsIterator<'_> ⓘ
An iterator over the locals (not including function parameters).