Skip to main content

webworker_fn

Attribute Macro webworker_fn 

Source
#[webworker_fn]
Expand description

A procedural macro that exports a simple function for use with a WebWorker.

Use this for functions that take a single argument and return a result synchronously. The function will be callable via WebWorkerFn and the webworker! macro.

§Example

use wasmworker_proc_macro::webworker_fn;

#[webworker_fn]
fn sort_vec(mut v: Vec<u32>) -> Vec<u32> {
    v.sort();
    v
}