Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Rusts wasm32-wasi and wasm32-unknown-unknown targets don't depend on Emscripten and they've been the preferred ways of targeting wasm for years now.

There is a wasm32-unknown-emscripten target but I think that's basically on life support if not outright deprecated. It was only really a stop-gap until native tooling like wasm_bindgen got fleshed out.



wasm32-unknown-emscripten is useful if you want to build a Rust program using SDL2 and GL for the Web, for example. But yes, as you said, it's much less used. Most Rust code on the Web is not a port of existing applications (which is what Emscripten focuses on), unlike C++.


Pity that not all tutorials have been updated, as I recently hit that bump, unfortunely I don't have the tutorial link any longer.


If you're targeting browsers then the Rust WASM book goes over using wasm32-unknown-unknown with wasm_bindgen to auto-generate the JS glue

https://rustwasm.github.io/docs/book/

If you're targeting some WASI-based platform then it's more straightforward, since no JS glue is needed. CF have a quick example

https://blog.cloudflare.com/announcing-wasi-on-workers/


Thanks for the links.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: