Module lunatic_runtime::plugin
source · [−]Expand description
Plugins are WebAssembly modules that can be attached to an Environment. They have 2 tasks:
- Modify other modules that are added to the
Environment - Spawn environment bound processes (TODO)
Each module that is being added to an Environment is going to get parsed into a
ModuleContext and Plugins will have an opportunity to modify this ModuleContext before it’s JIT
compiled. Theses modifications can include adding new types, functions and exports or wrapping
existing functions with additional code (TODO).
One common use case for Plugins is the addition of utility functions that can’t be expressed in
some languages. For example lunatic_call_indirect(table_index: u32) is used inside Rust code
compiled to WebAssembly, but it can’t be generated by the stable Rust compiler.
Another use case is inserting additional code into particular functions to collect data during
execution, for example as the heap_profiler plugin does.
Structs
WebAssembly module that can be attached to an Environment.