diff --git a/site/content/_index.md b/site/content/_index.md index ab117ac4..b893e5fd 100644 --- a/site/content/_index.md +++ b/site/content/_index.md @@ -110,6 +110,23 @@ include all JavaScript snippets generated by `wasm-bindgen` for interfacing with By default, functions exported from Rust, using `wasm-bingen`, can be accessed in the JavaScript code through the global variable `window.wasmBindings`. This behavior can be disabled, and the name can be customized. +## Library crate + +Aside from having a `main` function, it is also possible to up your project as a `cdylib` project. In order to do that, +add the following to your `Cargo.toml`: + +```toml +[lib] +crate-type = ["cdylib", "rlib"] +``` + +And then, define the entrypoint in your `lib.rs` like (does not need to be `async`): + +```rust +#[wasm_bindgen(start)] +pub async fn run() {} +``` + # Next Steps That's not all! Trunk has even more useful features. Head on over to the following sections to learn more about how to use Trunk effectively.