From 99b4151af8664e25c18e673949cc4133754ba8b8 Mon Sep 17 00:00:00 2001 From: Urhengulas Date: Tue, 16 Jun 2020 17:23:30 +0200 Subject: [PATCH] Update guide/src/reference/attributes/on-rust-exports/start.md Changes: * rename function from main to main_js * add hint that function can't be named main --- guide/src/reference/attributes/on-rust-exports/start.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/guide/src/reference/attributes/on-rust-exports/start.md b/guide/src/reference/attributes/on-rust-exports/start.md index 8dd52f7388f..239708bd4de 100644 --- a/guide/src/reference/attributes/on-rust-exports/start.md +++ b/guide/src/reference/attributes/on-rust-exports/start.md @@ -6,7 +6,7 @@ soon as the wasm module is instantiated. ```rust #[wasm_bindgen(start)] -pub fn main() { +pub fn main_js() { // executed automatically ... } ``` @@ -21,6 +21,7 @@ There's a few caveats to be aware of when using the `start` attribute: * The `start` function must take no arguments and must either return `()` or `Result<(), JsValue>` +* The name of the annotated function can't be `main` * Only one `start` function can be placed into a module, including its dependencies. If more than one is specified then `wasm-bindgen` will fail when the CLI is run. It's recommended that only applications use this attribute.