Struct wasmtime_environ::Module
source · pub struct Module {
pub signatures: PrimaryMap<SignatureIndex, Signature>,
pub imported_funcs: PrimaryMap<FuncIndex, (String, String)>,
pub imported_tables: PrimaryMap<TableIndex, (String, String)>,
pub imported_memories: PrimaryMap<MemoryIndex, (String, String)>,
pub imported_globals: PrimaryMap<GlobalIndex, (String, String)>,
pub functions: PrimaryMap<FuncIndex, SignatureIndex>,
pub table_plans: PrimaryMap<TableIndex, TablePlan>,
pub memory_plans: PrimaryMap<MemoryIndex, MemoryPlan>,
pub globals: PrimaryMap<GlobalIndex, Global>,
pub exports: HashMap<String, Export>,
pub start_func: Option<FuncIndex>,
pub table_elements: Vec<TableElements>,
}
Expand description
A translated WebAssembly module, excluding the function bodies and memory initializers.
Fields§
§signatures: PrimaryMap<SignatureIndex, Signature>
Unprocessed signatures exactly as provided by declare_signature()
.
imported_funcs: PrimaryMap<FuncIndex, (String, String)>
Names of imported functions.
imported_tables: PrimaryMap<TableIndex, (String, String)>
Names of imported tables.
imported_memories: PrimaryMap<MemoryIndex, (String, String)>
Names of imported memories.
imported_globals: PrimaryMap<GlobalIndex, (String, String)>
Names of imported globals.
functions: PrimaryMap<FuncIndex, SignatureIndex>
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.
exports: HashMap<String, Export>
Exported entities.
start_func: Option<FuncIndex>
The module “start” function, if present.
table_elements: Vec<TableElements>
WebAssembly table initializers.
Implementations§
source§impl Module
impl Module
sourcepub fn func_index(&self, defined_func: DefinedFuncIndex) -> FuncIndex
pub fn func_index(&self, defined_func: DefinedFuncIndex) -> FuncIndex
Convert a DefinedFuncIndex
into a FuncIndex
.
sourcepub fn defined_func_index(&self, func: FuncIndex) -> Option<DefinedFuncIndex>
pub fn defined_func_index(&self, func: FuncIndex) -> Option<DefinedFuncIndex>
Convert a FuncIndex
into a DefinedFuncIndex
. Returns None if the
index is an imported function.
sourcepub fn is_imported_function(&self, index: FuncIndex) -> bool
pub fn is_imported_function(&self, index: FuncIndex) -> bool
Test whether the given function index is for an imported function.
sourcepub fn table_index(&self, defined_table: DefinedTableIndex) -> TableIndex
pub fn table_index(&self, defined_table: DefinedTableIndex) -> TableIndex
Convert a DefinedTableIndex
into a TableIndex
.
sourcepub fn defined_table_index(&self, table: TableIndex) -> Option<DefinedTableIndex>
pub fn defined_table_index(&self, table: TableIndex) -> Option<DefinedTableIndex>
Convert a TableIndex
into a DefinedTableIndex
. Returns None if the
index is an imported table.
sourcepub fn is_imported_table(&self, index: TableIndex) -> bool
pub fn is_imported_table(&self, index: TableIndex) -> bool
Test whether the given table index is for an imported table.
sourcepub fn memory_index(&self, defined_memory: DefinedMemoryIndex) -> MemoryIndex
pub fn memory_index(&self, defined_memory: DefinedMemoryIndex) -> MemoryIndex
Convert a DefinedMemoryIndex
into a MemoryIndex
.
sourcepub fn defined_memory_index(
&self,
memory: MemoryIndex
) -> Option<DefinedMemoryIndex>
pub fn defined_memory_index(
&self,
memory: MemoryIndex
) -> Option<DefinedMemoryIndex>
Convert a MemoryIndex
into a DefinedMemoryIndex
. Returns None if the
index is an imported memory.
sourcepub fn is_imported_memory(&self, index: MemoryIndex) -> bool
pub fn is_imported_memory(&self, index: MemoryIndex) -> bool
Test whether the given memory index is for an imported memory.
sourcepub fn global_index(&self, defined_global: DefinedGlobalIndex) -> GlobalIndex
pub fn global_index(&self, defined_global: DefinedGlobalIndex) -> GlobalIndex
Convert a DefinedGlobalIndex
into a GlobalIndex
.
sourcepub fn defined_global_index(
&self,
global: GlobalIndex
) -> Option<DefinedGlobalIndex>
pub fn defined_global_index(
&self,
global: GlobalIndex
) -> Option<DefinedGlobalIndex>
Convert a GlobalIndex
into a DefinedGlobalIndex
. Returns None if the
index is an imported global.
sourcepub fn is_imported_global(&self, index: GlobalIndex) -> bool
pub fn is_imported_global(&self, index: GlobalIndex) -> bool
Test whether the given global index is for an imported global.