Struct wasm_bindgen_wasm_interpreter::Interpreter[][src]

pub struct Interpreter { /* fields omitted */ }
Expand description

A ready-to-go interpreter of a wasm module.

An interpreter currently represents effectively cached state. It is reused between calls to interpret and is precomputed from a Module. It houses state like the wasm stack, wasm memory, etc.

Implementations

Creates a new interpreter from a provided Module, precomputing all information necessary to interpret further.

Note that the module passed in to this function must be the same as the module passed to interpret below.

Interprets the execution of the descriptor function func.

This function will execute func in the module provided. Note that the module provided here must be the same as the one passed to new when this Interpreter was constructed.

The func must be a wasm-bindgen descriptor function meaning that it doesn’t do anything like use floats or i64. Instead all it should do is call other functions, sometimes some stack pointer manipulation, and then call the one imported __wbindgen_describe function. Anything else will cause this interpreter to panic.

When the descriptor has finished running the assembled descriptor list is returned. The descriptor returned can then be re-parsed into an actual Descriptor in the cli-support crate.

Return value

Returns Some if func was found in the module and None if it was not found in the module.

Interprets a “closure descriptor”, figuring out the signature of the closure that was intended.

This function will take an id which is known to internally execute __wbindgen_describe_closure and interpret it. The wasm-bindgen crate controls all callers of this internal import. It will then take the index passed to __wbindgen_describe_closure and interpret it as a function pointer. This means it’ll look up within the element section (function table) which index it points to. Upon finding the relevant entry it’ll assume that function is a descriptor function, and then it will execute the descriptor function.

The returned value is the return value of the descriptor function found. The entry_removal_list list is also then populated with an index of the entry in the elements section (and then the index within that section) of the function that needs to be snip’d out.

Returns the function id of the __wbindgen_describe_closure imported function.

Returns the detected id of the function table.

Trait Implementations

Returns the “default value” for a 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

Performs the conversion.

Performs the conversion.

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.