Struct wasmtime_environ::Module[][src]

pub struct Module {
Show fields pub name: Option<String>, pub initializers: Vec<Initializer>, pub exports: IndexMap<String, EntityIndex>, pub start_func: Option<FuncIndex>, pub table_initializers: Vec<TableInitializer>, pub memory_initialization: MemoryInitialization, pub passive_elements: Vec<Box<[FuncIndex]>>, pub passive_elements_map: HashMap<ElemIndex, usize>, pub passive_data: Vec<Arc<[u8]>>, pub passive_data_map: HashMap<DataIndex, usize>, pub func_names: HashMap<FuncIndex, String>, 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 functions: PrimaryMap<FuncIndex, SignatureIndex>, pub table_plans: PrimaryMap<TableIndex, TablePlan>, pub memory_plans: PrimaryMap<MemoryIndex, MemoryPlan>, pub globals: PrimaryMap<GlobalIndex, Global>, pub instances: PrimaryMap<InstanceIndex, InstanceTypeIndex>, pub modules: PrimaryMap<ModuleIndex, ModuleTypeIndex>, pub possibly_exported_funcs: HashSet<DefinedFuncIndex>,
}
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_initializers: Vec<TableInitializer>

WebAssembly table initializers.

memory_initialization: MemoryInitialization

WebAssembly linear memory initializer.

passive_elements: Vec<Box<[FuncIndex]>>

WebAssembly passive elements.

passive_elements_map: HashMap<ElemIndex, usize>

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

passive_data: Vec<Arc<[u8]>>

WebAssembly passive data segments.

passive_data_map: HashMap<DataIndex, usize>

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

func_names: HashMap<FuncIndex, String>

WebAssembly function names.

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.

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.

instances: PrimaryMap<InstanceIndex, InstanceTypeIndex>

The type of each wasm instance this module defines.

modules: PrimaryMap<ModuleIndex, ModuleTypeIndex>

The type of each nested wasm module this module contains.

possibly_exported_funcs: HashSet<DefinedFuncIndex>

The set of defined functions within this module which are located in element segments.

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 imports(&self) -> impl Iterator<Item = (&str, Option<&str>, EntityType)>[src]

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

pub fn type_of(&self, index: EntityIndex) -> EntityType[src]

Returns the type of an item based on its index

Trait Implementations

impl Clone for Module[src]

fn clone(&self) -> Module[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Module[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for Module[src]

fn default() -> Module[src]

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

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

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
    __D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl Serialize for Module[src]

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

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

recently added

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

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

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