How do I use Rust with Wasm with multiple Rust files?

I'm using wasm-pack build --target web.
My project has a and a I've got a function in my which I'm invoking in But I'm unsure where to put the #[wasm_bindgen] macro and how I import this function into my js file.

You might want to go through the Conway's Game of Life tutorial from the wasm-bindgen docs. It explains a lot about how #[wasm_bindgen] attribute is used and the process of integrating a Rust library into a JavaScript application.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.