[][src]Struct wasmtime_environ::Module

pub struct Module {
    pub id: usize,
    pub name: Option<String>,
    pub imports: Vec<(String, String, EntityIndex)>,
    pub exports: IndexMap<String, EntityIndex>,
    pub start_func: Option<FuncIndex>,
    pub table_elements: Vec<TableElements>,
    pub passive_elements: HashMap<ElemIndex, Box<[FuncIndex]>>,
    pub passive_data: HashMap<DataIndex, Arc<[u8]>>,
    pub func_names: HashMap<FuncIndex, String>,
    pub signatures: PrimaryMap<SignatureIndex, (WasmFuncType, Signature)>,
    pub num_imported_funcs: usize,
    pub num_imported_tables: usize,
    pub num_imported_memories: usize,
    pub num_imported_globals: usize,
    pub functions: PrimaryMap<FuncIndex, SignatureIndex>,
    pub table_plans: PrimaryMap<TableIndex, TablePlan>,
    pub memory_plans: PrimaryMap<MemoryIndex, MemoryPlan>,
    pub globals: PrimaryMap<GlobalIndex, Global>,
}

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

Fields

id: usize

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

name: Option<String>

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

imports: Vec<(String, String, EntityIndex)>

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_elements: Vec<TableElements>

WebAssembly table initializers.

passive_elements: HashMap<ElemIndex, Box<[FuncIndex]>>

WebAssembly passive elements.

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

WebAssembly passive data segments.

func_names: HashMap<FuncIndex, String>

WebAssembly table initializers.

signatures: PrimaryMap<SignatureIndex, (WasmFuncType, Signature)>

Unprocessed signatures exactly as provided by declare_signature().

num_imported_funcs: 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.

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.

Implementations

impl Module[src]

pub fn new() -> Self[src]

Allocates the module data structures.

pub fn get_passive_element(&self, index: ElemIndex) -> Option<&[FuncIndex]>[src]

Get the given passive element, if it exists.

pub fn func_index(&self, defined_func: DefinedFuncIndex) -> FuncIndex[src]

Convert a DefinedFuncIndex into a FuncIndex.

pub fn defined_func_index(&self, func: FuncIndex) -> Option<DefinedFuncIndex>[src]

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

pub fn is_imported_function(&self, index: FuncIndex) -> bool[src]

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

pub fn table_index(&self, defined_table: DefinedTableIndex) -> TableIndex[src]

Convert a DefinedTableIndex into a TableIndex.

pub fn defined_table_index(
    &self,
    table: TableIndex
) -> Option<DefinedTableIndex>
[src]

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

pub fn is_imported_table(&self, index: TableIndex) -> bool[src]

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

pub fn memory_index(&self, defined_memory: DefinedMemoryIndex) -> MemoryIndex[src]

Convert a DefinedMemoryIndex into a MemoryIndex.

pub fn defined_memory_index(
    &self,
    memory: MemoryIndex
) -> Option<DefinedMemoryIndex>
[src]

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

pub fn is_imported_memory(&self, index: MemoryIndex) -> bool[src]

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

pub fn global_index(&self, defined_global: DefinedGlobalIndex) -> GlobalIndex[src]

Convert a DefinedGlobalIndex into a GlobalIndex.

pub fn defined_global_index(
    &self,
    global: GlobalIndex
) -> Option<DefinedGlobalIndex>
[src]

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

pub fn is_imported_global(&self, index: GlobalIndex) -> bool[src]

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

pub fn native_func_signature(&self, func_index: FuncIndex) -> &Signature[src]

Convenience method for looking up the native signature of a compiled Wasm function.

pub fn wasm_func_type(&self, func_index: FuncIndex) -> &WasmFuncType[src]

Convenience method for looking up the original Wasm signature of a function.

Trait Implementations

impl Clone for Module[src]

impl Debug for Module[src]

impl<'de> Deserialize<'de> for Module[src]

impl Serialize for Module[src]

Auto Trait Implementations

impl RefUnwindSafe for Module

impl Send for Module

impl Sync for Module

impl Unpin for Module

impl UnwindSafe for Module

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.