Skip to content

Commit

Permalink
Expose init_thread_pool in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
RReverser committed Dec 21, 2024
1 parent 489284f commit 1615cb1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ In order to reduce risk of breakages, it's strongly recommended to use a fixed n
The easiest way to configure those flags is:

1. Put the following in a `rust-toolchain.toml` file in your project directory:

```toml
[toolchain]
channel = "nightly-2024-08-02"
Expand Down
7 changes: 6 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,13 @@ impl wbg_rayon_PoolBuilder {
}
}

/// Function exposed as `initThreadPool` to JS (see the main docs).
///
/// Normally, you'd invoke this function from JS to initialize the thread pool.
/// However, if you strongly prefer, you can use [wasm-bindgen-futures](https://rustwasm.github.io/wasm-bindgen/reference/js-promises-and-rust-futures.html) to invoke and await this function from Rust.
///
/// Note that doing so comes with extra initialization and Wasm size overhead for the JS<->Rust Promise integration.
#[wasm_bindgen(js_name = initThreadPool)]
#[doc(hidden)]
pub fn init_thread_pool(num_threads: usize) -> Promise {
start_workers(
wasm_bindgen::module(),
Expand Down

0 comments on commit 1615cb1

Please sign in to comment.