pub struct Module {
Show 19 fields pub name: Option<String>, pub initializers: Vec<Initializer>, pub exports: IndexMap<String, EntityIndex>, pub start_func: Option<FuncIndex>, pub table_initialization: TableInitialization, pub memory_initialization: MemoryInitialization, pub passive_elements: Vec<Box<[FuncIndex]>>, pub passive_elements_map: BTreeMap<ElemIndex, usize>, pub passive_data_map: BTreeMap<DataIndex, Range<u32>>, pub types: PrimaryMap<TypeIndex, ModuleType>, pub num_imported_funcs: usize, pub num_imported_tables: usize, pub num_imported_memories: usize, pub num_imported_globals: usize, pub num_escaped_funcs: usize, pub functions: PrimaryMap<FuncIndex, FunctionType>, pub table_plans: PrimaryMap<TableIndex, TablePlan>, pub memory_plans: PrimaryMap<MemoryIndex, MemoryPlan>, pub globals: PrimaryMap<GlobalIndex, Global>,
}
Expand description

A translated WebAssembly module, excluding the function bodies and memory initializers.

Fields

name: Option<String>

The name of this wasm module, often found in the wasm file.

initializers: Vec<Initializer>

All import records, in the order they are declared in the module.

exports: IndexMap<String, EntityIndex>

Exported entities.

start_func: Option<FuncIndex>

The module “start” function, if present.

table_initialization: TableInitialization

WebAssembly table initialization data, per table.

memory_initialization: MemoryInitialization

WebAssembly linear memory initializer.

passive_elements: Vec<Box<[FuncIndex]>>

WebAssembly passive elements.

passive_elements_map: BTreeMap<ElemIndex, usize>

The map from passive element index (element segment index space) to index in passive_elements.

passive_data_map: BTreeMap<DataIndex, Range<u32>>

The map from passive data index (data segment index space) to index in passive_data.

types: PrimaryMap<TypeIndex, ModuleType>

Types declared in the wasm module.

num_imported_funcs: usize

Number of imported or aliased functions in the module.

num_imported_tables: usize

Number of imported or aliased tables in the module.

num_imported_memories: usize

Number of imported or aliased memories in the module.

num_imported_globals: usize

Number of imported or aliased globals in the module.

num_escaped_funcs: usize

Number of functions that “escape” from this module may need to have a VMCallerCheckedAnyfunc constructed for them.

This is also the number of functions in the functions array below with an anyfunc index (and is the maximum anyfunc index).

functions: PrimaryMap<FuncIndex, FunctionType>

Types of functions, imported and local.

table_plans: PrimaryMap<TableIndex, TablePlan>

WebAssembly tables.

memory_plans: PrimaryMap<MemoryIndex, MemoryPlan>

WebAssembly linear memory plans.

globals: PrimaryMap<GlobalIndex, Global>

WebAssembly global variables.

Implementations

Allocates the module data structures.

Convert a DefinedFuncIndex into a FuncIndex.

Convert a FuncIndex into a DefinedFuncIndex. Returns None if the index is an imported function.

Test whether the given function index is for an imported function.

Convert a DefinedTableIndex into a TableIndex.

Convert a TableIndex into a DefinedTableIndex. Returns None if the index is an imported table.

Test whether the given table index is for an imported table.

Convert a DefinedMemoryIndex into a MemoryIndex.

Convert a MemoryIndex into a DefinedMemoryIndex. Returns None if the index is an imported memory.

Test whether the given memory index is for an imported memory.

Convert a DefinedGlobalIndex into a GlobalIndex.

Convert a GlobalIndex into a DefinedGlobalIndex. Returns None if the index is an imported global.

Test whether the given global index is for an imported global.

Returns an iterator of all the imports in this module, along with their module name, field name, and type that’s being imported.

Returns the type of an item based on its index

Appends a new function to this module with the given type information, used for functions that either don’t escape or aren’t certain whether they escape yet.

Appends a new function to this module with the given type information.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.