I made a game with Rust and WASM as well, and I had some of the same issues. I naturally just decided to put things like event listeners in JavaScript, but just about everything else worked in pure Rust with little complexity.
Macros aren't an option?
I'm not sure about macros in this case, but the usual way to go about adding event listeners straight into Rust is using dynamic clojures.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I made a game with Rust and WASM as well, and I had some of the same issues. I naturally just decided to put things like event listeners in JavaScript, but just about everything else worked in pure Rust with little complexity.
Macros aren't an option?
I'm not sure about macros in this case, but the usual way to go about adding event listeners straight into Rust is using dynamic clojures.