Creates a new Rust module from the provided code.
Rust source code to compile.
Optionalsymbols: CSymbolsSymbols to expose to the Rust module. Declare them as
extern "C". This may for example be one or more memory blocks allocated
using Memory.alloc(), and/or NativeCallback values for receiving
callbacks from the Rust module.
Optionaloptions: RustModuleOptionsOptions for customizing the construction.
Compiles Rust source code to machine code, straight to memory.
Useful for implementing hot callbacks, e.g. for
InterceptorandStalker, but also useful when needing to start new threads in order to call functions in a tight loop, e.g. for fuzzing purposes.Public functions are automatically exported as
NativePointerproperties. This means you can pass them toInterceptorandStalker, or call them usingNativeFunction. In such cases you typically want to ensure they are marked#[no_mangle]andextern "C".In addition to Rust libraries, the code being mapped in can also communicate with JavaScript through the symbols exposed to it. These can be plugged in at creation, e.g. to share memory allocated using
Memory.alloc(), orNativeCallbackvalues for receiving callbacks from the Rust module.