pub struct Compilation {
    pub functions: Functions,
    pub custom_sections: CustomSections,
    pub function_call_trampolines: PrimaryMap<SignatureIndex, FunctionBody>,
    pub dynamic_function_trampolines: PrimaryMap<FunctionIndex, FunctionBody>,
    pub debug: Option<Dwarf>,
}
Expand description

The result of compiling a WebAssembly module’s functions.

Fields§

§functions: Functions

Compiled code for the function bodies.

§custom_sections: CustomSections

Custom sections for the module. It will hold the data, for example, for constants used in a function, global variables, rodata_64, hot/cold function partitioning, …

§function_call_trampolines: PrimaryMap<SignatureIndex, FunctionBody>

Trampolines to call a function defined locally in the wasm via a provided Vec of values.

This allows us to call easily Wasm functions, such as:

let func = instance.exports.get_function("my_func");
func.call(&[Value::I32(1)]);
§dynamic_function_trampolines: PrimaryMap<FunctionIndex, FunctionBody>

Trampolines to call a dynamic function defined in a host, from a Wasm module.

This allows us to create dynamic Wasm functions, such as:

fn my_func(values: &[Val]) -> Result<Vec<Val>, RuntimeError> {
    // do something
}

let my_func_type = FunctionType::new(vec![Type::I32], vec![Type::I32]);
let imports = imports!{
    "namespace" => {
        "my_func" => Function::new(&store, my_func_type, my_func),
    }
}

Note: Dynamic function trampolines are only compiled for imported function types.

§debug: Option<Dwarf>

Section ids corresponding to the Dwarf debug info

Trait Implementations§

Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. 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.
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Deserializes using the given deserializer
Compare self to key and return true if they are equal.

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 for metadata in pointers and references to Self.
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.