Skip to main content

split

Attribute Macro split 

Source
#[split]
Expand description

Mark a function to be split into a separate WebAssembly module.

For more details on arguments usage see [SplitArgs] - it can be not shown in default docs building, so use cargo doc --document-private-items.

§Examples

use wamex::split;
#[split(my_module, wrap_return_with(SomeWrapper))]
async fn my_function(arg1: i32, arg2: String) -> ResultType {
    // function body
}

Using it in tandem with wamex-cli split command will extract this function into a separate WebAssembly module named my_module_<VERSION>.wasm, and the function will be loaded and executed at runtime using the specified loader.