You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm hoping someone could help me out. I've been working through the RustWasm book wasm-game-of-life tutorial but hit a snag.
When I compile Rust to wasm and import it into Javascript the struct turns into a class fine but I cannot invoke any of its methods. The console shows a Universe.new is not a function error - which is weird because the generated .d.ts file includes the method. If I invoke the class with new Universe() I get another error: Error: null pointer passed to rust. Finally I tried adding a #[wasm_bindgen(constructor)] macro to the Universe.new() struct impl which resulted in wasm-pack build throwing yet another error Caused by: failed to execute wasm-bindgen: exited with exit status: 101.
I've googled all these errors and can't find a way to move forward. It'd love if someone could take a look at my code (https://github.com/Rennzie/wasm-game-of-life) and help me out?
I've upgrade to the latest edition of rust (2021) and all my packages in cargo.toml are at latest:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I'm hoping someone could help me out. I've been working through the RustWasm book
wasm-game-of-life
tutorial but hit a snag.When I compile Rust to wasm and import it into Javascript the struct turns into a class fine but I cannot invoke any of its methods. The console shows a
Universe.new is not a function
error - which is weird because the generated .d.ts file includes the method. If I invoke the class withnew Universe()
I get another error:Error: null pointer passed to rust
. Finally I tried adding a#[wasm_bindgen(constructor)]
macro to theUniverse.new()
struct impl which resulted in wasm-pack build throwing yet another errorCaused by: failed to execute wasm-bindgen: exited with exit status: 101
.I've googled all these errors and can't find a way to move forward. It'd love if someone could take a look at my code (https://github.com/Rennzie/wasm-game-of-life) and help me out?
I've upgrade to the latest edition of rust (2021) and all my packages in cargo.toml are at latest:
Beta Was this translation helpful? Give feedback.
All reactions