pub struct DummyEnvironment {
    pub info: DummyModuleInfo,
    pub trans: FuncTranslator,
    pub func_bytecode_sizes: Vec<usize>,
    pub debug_info: bool,
    pub module_name: Option<String>,
    /* private fields */
}
Expand description

This ModuleEnvironment implementation is a “naïve” one, doing essentially nothing and emitting placeholders when forced to. Don’t try to execute code translated for this environment, essentially here for translation debug purposes.

Fields§

§info: DummyModuleInfo

Module information.

§trans: FuncTranslator

Function translation.

§func_bytecode_sizes: Vec<usize>

Vector of wasm bytecode size for each function.

§debug_info: bool

Instructs to collect debug data during translation.

§module_name: Option<String>

Name of the module from the wasm file.

Implementations§

Creates a new DummyEnvironment instance.

Return a DummyFuncEnvironment for translating functions within this DummyEnvironment.

Get the type for the function at the given index.

Return the number of imported functions within this DummyEnvironment.

Return the name of the function, if a name for the function with the corresponding index exists.

Test reachability bits before and after every opcode during translation, as provided by the FuncTranslationState. This is generally used only for unit tests. This is applied to every function in the module (so is likely only useful for test modules with one function).

Trait Implementations§

Declares a function signature to the environment.
Declares a function import to the environment.
Declares the type (signature) of a local function in the module.
Declares a global to the environment.
Declares a global import to the environment.
Declares a table to the environment.
Declares a table import to the environment.
Fills a declared table with references to functions in the module.
Declare a passive element segment.
Declare a passive data segment.
Declares a memory to the environment
Declares a memory import to the environment.
Fills a declared memory with bytes at module instantiation.
Declares a function export to the environment.
Declares a table export to the environment.
Declares a memory export to the environment.
Declares a global export to the environment.
Declares the optional start function.
Provides the contents of a function body.
Declares the name of a module to the environment. Read more
Declares the name of a function to the environment. Read more
Returns the list of enabled wasm features this translation will be using.
Provides the number of types up front. By default this does nothing, but implementations can use this to preallocate memory if desired.
Translates a type index to its signature index, only called for type indices which point to functions.
Provides the number of imports up front. By default this does nothing, but implementations can use this to preallocate memory if desired.
Declares an tag import to the environment.
Notifies the implementation that all imports have been declared.
Provides the number of defined functions up front. By default this does nothing, but implementations can use this to preallocate memory if desired.
Provides the number of defined tables up front. By default this does nothing, but implementations can use this to preallocate memory if desired.
Provides the number of defined memories up front. By default this does nothing, but implementations can use this to preallocate memory if desired.
Provides the number of defined tags up front. By default this does nothing, but implementations can use this to preallocate memory if desired.
Declares an tag to the environment
Provides the number of defined globals up front. By default this does nothing, but implementations can use this to preallocate memory if desired.
Provides the number of exports up front. By default this does nothing, but implementations can use this to preallocate memory if desired.
Declares an tag export to the environment.
Notifies the implementation that all exports have been declared.
Provides the number of element initializers up front. By default this does nothing, but implementations can use this to preallocate memory if desired.
Indicates that a declarative element segment was seen in the wasm module.
Provides the number of passive data segments up front. Read more
Indicates how many functions the code section reports and the byte offset of where the code sections starts.
Provides the number of data initializers up front. By default this does nothing, but implementations can use this to preallocate memory if desired.
Declares the name of a function’s local to the environment. Read more
Indicates that a custom section has been found in the wasm file
Get the information needed to produce Cranelift IR for the given target.
Whether to enable Spectre mitigations for heap accesses.
Get the Cranelift integer type to use for native pointers. Read more
Get the size of a native pointer, in bytes.
Get the Cranelift reference type to use for the given Wasm reference type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.