Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore use of wasm-bindgen instead of stdweb #329

Closed
josephlr opened this issue Sep 14, 2020 · 3 comments · Fixed by #333
Closed

Explore use of wasm-bindgen instead of stdweb #329

josephlr opened this issue Sep 14, 2020 · 3 comments · Fixed by #333

Comments

@josephlr
Copy link

The wasm-bindgen toolchain is much better supported than stdweb and is the "official" way to call into JS from Rust. As seen in #288, stdweb and cargo-web don't see a lot of attention. The gerandom/rand crates also had to disable testing for cargo-web due to lack of upstream support.

The issue screeps/screeps#120 and this feature request descirbe the necessary first steps to supporting wasm-bindgen.

@shanemadden
Copy link
Collaborator

Thanks - we'd been unofficially talking about this being inevitable but having an issue makes it official!

I was able to get the start going on a proof of concept of a move over to bindgen over a couple weekends a while back (and came across the same string struggles, as you'll see) over in the bindgen branch, and just haven't had the time to push further forward in getting all the interfaces implemented. There's a pretty hefty bit of implementation work still to go, plus adapting cargo-screeps, but I was pretty happy with the experience working with bindgen so far - it seems like it won't be too painful to make the move happen.

If you're interested, here's the notes that I have on getting started with the bindgen builds which just implements a couple basic game interfaces and game object types at the moment. I'm hoping to have some more time to work on the conversion before too long, but if you're inclined, PRs against the bindgen branch would be welcome.

@josephlr
Copy link
Author

Note that rustwasm/wasm-bindgen#2310 would reduce the amount of changes we need to make to the generated file.

@GRASBOCK
Copy link

I am all for this. I want to use console_error_panic_hook to get proper error messages and be able to panic again when something fails unexpectedly. It unfortunately fails to compile as some dependencies need the newer toolchain. Overall I see a lot of potential to fix a lot of inconvenient bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants