Struct wasmtime_environ::ModuleEnvironment [−][src]
Object containing the standalone environment information.
Implementations
impl<'data> ModuleEnvironment<'data>
[src]
pub fn new(
target_config: TargetFrontendConfig,
tunables: &Tunables,
features: &WasmFeatures
) -> Self
[src]
target_config: TargetFrontendConfig,
tunables: &Tunables,
features: &WasmFeatures
) -> Self
Allocates the environment data structures.
pub fn translate(
self,
data: &'data [u8]
) -> WasmResult<(usize, Vec<ModuleTranslation<'data>>, TypeTables)>
[src]
self,
data: &'data [u8]
) -> WasmResult<(usize, Vec<ModuleTranslation<'data>>, TypeTables)>
Translate a wasm module using this environment.
This consumes the ModuleEnvironment
and produces a list of
ModuleTranslation
s as well as a TypeTables
. The list of module
translations corresponds to all wasm modules found in the input data
.
Note that for MVP modules this will always be a list with one element,
but with the module linking proposal this may have many elements.
For the module linking proposal the top-level module is returned as the first return value.
The TypeTables
structure returned contains intern’d versions of types
referenced from each module translation. This primarily serves as the
source of truth for module-linking use cases where modules can refer to
other module’s types. All SignatureIndex
, ModuleTypeIndex
, and
InstanceTypeIndex
values are resolved through the returned tables.
Trait Implementations
impl<'data> ModuleEnvironment<'data> for ModuleEnvironment<'data>
[src]
This trait is useful for translate_module
because it tells how to translate
environment-dependent wasm instructions. These functions should not be called by the user.
fn reserve_types(&mut self, num: u32) -> WasmResult<()>
[src]
fn declare_type_func(
&mut self,
wasm: WasmFuncType,
sig: Signature
) -> WasmResult<()>
[src]
&mut self,
wasm: WasmFuncType,
sig: Signature
) -> WasmResult<()>
fn declare_type_module(
&mut self,
declared_imports: &[(&'data str, Option<&'data str>, EntityType)],
exports: &[(&'data str, EntityType)]
) -> WasmResult<()>
[src]
&mut self,
declared_imports: &[(&'data str, Option<&'data str>, EntityType)],
exports: &[(&'data str, EntityType)]
) -> WasmResult<()>
fn declare_type_instance(
&mut self,
exports: &[(&'data str, EntityType)]
) -> WasmResult<()>
[src]
&mut self,
exports: &[(&'data str, EntityType)]
) -> WasmResult<()>
fn type_to_signature(&self, index: TypeIndex) -> WasmResult<SignatureIndex>
[src]
fn type_to_module_type(&self, index: TypeIndex) -> WasmResult<ModuleTypeIndex>
[src]
fn type_to_instance_type(
&self,
index: TypeIndex
) -> WasmResult<InstanceTypeIndex>
[src]
&self,
index: TypeIndex
) -> WasmResult<InstanceTypeIndex>
fn reserve_imports(&mut self, num: u32) -> WasmResult<()>
[src]
fn declare_func_import(
&mut self,
index: TypeIndex,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
[src]
&mut self,
index: TypeIndex,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
fn declare_table_import(
&mut self,
table: Table,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
[src]
&mut self,
table: Table,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
fn declare_memory_import(
&mut self,
memory: Memory,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
[src]
&mut self,
memory: Memory,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
fn declare_global_import(
&mut self,
global: Global,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
[src]
&mut self,
global: Global,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
fn declare_module_import(
&mut self,
ty_index: TypeIndex,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
[src]
&mut self,
ty_index: TypeIndex,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
fn declare_instance_import(
&mut self,
ty_index: TypeIndex,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
[src]
&mut self,
ty_index: TypeIndex,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
fn reserve_func_types(&mut self, num: u32) -> WasmResult<()>
[src]
fn declare_func_type(&mut self, index: TypeIndex) -> WasmResult<()>
[src]
fn reserve_tables(&mut self, num: u32) -> WasmResult<()>
[src]
fn declare_table(&mut self, table: Table) -> WasmResult<()>
[src]
fn reserve_memories(&mut self, num: u32) -> WasmResult<()>
[src]
fn declare_memory(&mut self, memory: Memory) -> WasmResult<()>
[src]
fn reserve_globals(&mut self, num: u32) -> WasmResult<()>
[src]
fn declare_global(&mut self, global: Global) -> WasmResult<()>
[src]
fn reserve_exports(&mut self, num: u32) -> WasmResult<()>
[src]
fn declare_func_export(
&mut self,
func_index: FuncIndex,
name: &str
) -> WasmResult<()>
[src]
&mut self,
func_index: FuncIndex,
name: &str
) -> WasmResult<()>
fn declare_table_export(
&mut self,
table_index: TableIndex,
name: &str
) -> WasmResult<()>
[src]
&mut self,
table_index: TableIndex,
name: &str
) -> WasmResult<()>
fn declare_memory_export(
&mut self,
memory_index: MemoryIndex,
name: &str
) -> WasmResult<()>
[src]
&mut self,
memory_index: MemoryIndex,
name: &str
) -> WasmResult<()>
fn declare_global_export(
&mut self,
global_index: GlobalIndex,
name: &str
) -> WasmResult<()>
[src]
&mut self,
global_index: GlobalIndex,
name: &str
) -> WasmResult<()>
fn declare_module_export(
&mut self,
index: ModuleIndex,
name: &str
) -> WasmResult<()>
[src]
&mut self,
index: ModuleIndex,
name: &str
) -> WasmResult<()>
fn declare_instance_export(
&mut self,
index: InstanceIndex,
name: &str
) -> WasmResult<()>
[src]
&mut self,
index: InstanceIndex,
name: &str
) -> WasmResult<()>
fn declare_start_func(&mut self, func_index: FuncIndex) -> WasmResult<()>
[src]
fn reserve_table_elements(&mut self, num: u32) -> WasmResult<()>
[src]
fn declare_table_elements(
&mut self,
table_index: TableIndex,
base: Option<GlobalIndex>,
offset: usize,
elements: Box<[FuncIndex]>
) -> WasmResult<()>
[src]
&mut self,
table_index: TableIndex,
base: Option<GlobalIndex>,
offset: usize,
elements: Box<[FuncIndex]>
) -> WasmResult<()>
fn declare_passive_element(
&mut self,
elem_index: ElemIndex,
segments: Box<[FuncIndex]>
) -> WasmResult<()>
[src]
&mut self,
elem_index: ElemIndex,
segments: Box<[FuncIndex]>
) -> WasmResult<()>
fn reserve_function_bodies(&mut self, _count: u32, offset: u64)
[src]
fn define_function_body(
&mut self,
validator: FuncValidator<ValidatorResources>,
body: FunctionBody<'data>
) -> WasmResult<()>
[src]
&mut self,
validator: FuncValidator<ValidatorResources>,
body: FunctionBody<'data>
) -> WasmResult<()>
fn reserve_data_initializers(&mut self, num: u32) -> WasmResult<()>
[src]
fn declare_data_initialization(
&mut self,
memory_index: MemoryIndex,
base: Option<GlobalIndex>,
offset: usize,
data: &'data [u8]
) -> WasmResult<()>
[src]
&mut self,
memory_index: MemoryIndex,
base: Option<GlobalIndex>,
offset: usize,
data: &'data [u8]
) -> WasmResult<()>
fn reserve_passive_data(&mut self, _count: u32) -> WasmResult<()>
[src]
fn declare_passive_data(
&mut self,
data_index: DataIndex,
data: &'data [u8]
) -> WasmResult<()>
[src]
&mut self,
data_index: DataIndex,
data: &'data [u8]
) -> WasmResult<()>
fn declare_module_name(&mut self, name: &'data str)
[src]
fn declare_func_name(&mut self, func_index: FuncIndex, name: &'data str)
[src]
fn declare_local_name(
&mut self,
func_index: FuncIndex,
local: u32,
name: &'data str
)
[src]
&mut self,
func_index: FuncIndex,
local: u32,
name: &'data str
)
fn custom_section(
&mut self,
name: &'data str,
data: &'data [u8]
) -> WasmResult<()>
[src]
&mut self,
name: &'data str,
data: &'data [u8]
) -> WasmResult<()>
fn wasm_features(&self) -> WasmFeatures
[src]
fn reserve_modules(&mut self, amount: u32)
[src]
fn module_start(&mut self)
[src]
fn module_end(&mut self)
[src]
fn reserve_instances(&mut self, amt: u32)
[src]
fn declare_instance(
&mut self,
module: ModuleIndex,
args: Vec<(&'data str, EntityIndex)>
) -> WasmResult<()>
[src]
&mut self,
module: ModuleIndex,
args: Vec<(&'data str, EntityIndex)>
) -> WasmResult<()>
fn declare_alias(&mut self, alias: Alias<'_>) -> WasmResult<()>
[src]
pub fn declare_event_import(
&mut self,
event: Event,
module: &'data str,
field: Option<&'data str>
) -> Result<(), WasmError>
[src]
&mut self,
event: Event,
module: &'data str,
field: Option<&'data str>
) -> Result<(), WasmError>
pub fn finish_imports(&mut self) -> Result<(), WasmError>
[src]
pub fn reserve_events(&mut self, _num: u32) -> Result<(), WasmError>
[src]
pub fn declare_event(&mut self, event: Event) -> Result<(), WasmError>
[src]
pub fn declare_event_export(
&mut self,
event_index: EventIndex,
name: &'data str
) -> Result<(), WasmError>
[src]
&mut self,
event_index: EventIndex,
name: &'data str
) -> Result<(), WasmError>
pub fn finish_exports(&mut self) -> Result<(), WasmError>
[src]
impl<'data> TargetEnvironment for ModuleEnvironment<'data>
[src]
fn target_config(&self) -> TargetFrontendConfig
[src]
fn reference_type(&self, ty: WasmType) -> Type
[src]
pub fn pointer_type(&self) -> Type
[src]
pub fn pointer_bytes(&self) -> u8
[src]
Auto Trait Implementations
impl<'data> RefUnwindSafe for ModuleEnvironment<'data>
impl<'data> Send for ModuleEnvironment<'data>
impl<'data> Sync for ModuleEnvironment<'data>
impl<'data> Unpin for ModuleEnvironment<'data>
impl<'data> UnwindSafe for ModuleEnvironment<'data>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,