Struct wasmer_vm::ModuleInfo[][src]

pub struct ModuleInfo {
Show 21 fields pub id: ModuleId, pub name: Option<String>, pub imports: IndexMap<(String, String, u32), ImportIndex, RandomState>, pub exports: IndexMap<String, ExportIndex, RandomState>, pub start_function: Option<FunctionIndex>, pub table_initializers: Vec<TableInitializer, Global>, pub passive_elements: HashMap<ElemIndex, Box<[FunctionIndex], Global>, RandomState>, pub passive_data: HashMap<DataIndex, Arc<[u8]>, RandomState>, pub global_initializers: PrimaryMap<LocalGlobalIndex, GlobalInit>, pub function_names: HashMap<FunctionIndex, String, RandomState>, pub signatures: PrimaryMap<SignatureIndex, FunctionType>, pub functions: PrimaryMap<FunctionIndex, SignatureIndex>, pub tables: PrimaryMap<TableIndex, TableType>, pub memories: PrimaryMap<MemoryIndex, MemoryType>, pub globals: PrimaryMap<GlobalIndex, GlobalType>, pub custom_sections: IndexMap<String, CustomSectionIndex, RandomState>, pub custom_sections_data: PrimaryMap<CustomSectionIndex, Arc<[u8]>>, pub num_imported_functions: usize, pub num_imported_tables: usize, pub num_imported_memories: usize, pub num_imported_globals: usize,
}
Expand description

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

Fields

id: ModuleId

A unique identifier (within this process) for this module.

We skip serialization/deserialization of this field, as it should be computed by the process. It’s not skipped in rkyv, but that is okay, because even though it’s skipped in bincode/serde it’s still deserialized back as a garbage number, and later override from computed by the process

name: Option<String>

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

imports: IndexMap<(String, String, u32), ImportIndex, RandomState>

Imported entities with the (module, field, index_of_the_import)

Keeping the index_of_the_import is important, as there can be two same references to the same import, and we don’t want to confuse them.

exports: IndexMap<String, ExportIndex, RandomState>

Exported entities.

start_function: Option<FunctionIndex>

The module “start” function, if present.

table_initializers: Vec<TableInitializer, Global>

WebAssembly table initializers.

passive_elements: HashMap<ElemIndex, Box<[FunctionIndex], Global>, RandomState>

WebAssembly passive elements.

passive_data: HashMap<DataIndex, Arc<[u8]>, RandomState>

WebAssembly passive data segments.

global_initializers: PrimaryMap<LocalGlobalIndex, GlobalInit>

WebAssembly global initializers.

function_names: HashMap<FunctionIndex, String, RandomState>

WebAssembly function names.

signatures: PrimaryMap<SignatureIndex, FunctionType>

WebAssembly function signatures.

functions: PrimaryMap<FunctionIndex, SignatureIndex>

WebAssembly functions (imported and local).

tables: PrimaryMap<TableIndex, TableType>

WebAssembly tables (imported and local).

memories: PrimaryMap<MemoryIndex, MemoryType>

WebAssembly linear memories (imported and local).

globals: PrimaryMap<GlobalIndex, GlobalType>

WebAssembly global variables (imported and local).

custom_sections: IndexMap<String, CustomSectionIndex, RandomState>

Custom sections in the module.

custom_sections_data: PrimaryMap<CustomSectionIndex, Arc<[u8]>>

The data for each CustomSection in the module.

num_imported_functions: usize

Number of imported functions in the module.

num_imported_tables: usize

Number of imported tables in the module.

num_imported_memories: usize

Number of imported memories in the module.

num_imported_globals: usize

Number of imported globals in the module.

Implementations

Allocates the module data structures.

Get the given passive element, if it exists.

Get the exported signatures of the module

Get the export types of the module

Get the import types of the module

Get the custom sections of the module given a name.

Convert a LocalFunctionIndex into a FunctionIndex.

Convert a FunctionIndex into a LocalFunctionIndex. Returns None if the index is an imported function.

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

Convert a LocalTableIndex into a TableIndex.

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

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

Convert a LocalMemoryIndex into a MemoryIndex.

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

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

Convert a LocalGlobalIndex into a GlobalIndex.

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

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

Get the Module name

Get the imported function types of the module.

Trait Implementations

The archived version of this type.

The resolver for this type. It must contain all the information needed to make the archived type from the normal type. Read more

Creates the archived version of this value at the given position and writes it to the given output. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

Deserializes using the given deserializer

Formats the value using the given formatter. Read more

Performs the conversion.

Returns the size of the referenced value in bytes. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Writes the dependencies for the object and returns a resolver that can create the archived type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

The archived version of the pointer metadata for this type.

Converts some archived metadata to the pointer metadata for itself.

The archived counterpart of this type. Unlike Archive, it may be unsized.

The resolver for the metadata of this type.

Creates the archived version of the metadata for this value at the given position and writes it to the given output. Read more

Resolves a relative pointer to this value with the given from and to and writes it to the given output. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Performs the conversion.

Performs the conversion.

The type for metadata in pointers and references to Self.

Writes the object and returns the position of the archived type.

Serializes the metadata for the given type.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

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.