Hi all,
We recently landed support for the Emscripten target in the wasm-bindgen project and are exploring its adoption more widely for its benefits over the wasm32-unknown-unknown platform agnostic target, in allowing better libc compatibility.
In the Rust ecosystem, Tokio is an async runtime that supports various targets including only the WASI targets for Wasm, but it does not yet have full support for the Emscripten Wasm target.
This means that when building Rust projects for the Emscripten target, applications using Tokio async features will likely not build correctly.
There are perhaps two main runtime variations that can work for Emscripten on Tokio here - a "hosted event loop" single-threaded runtime, with or without a JSPI switch, and a comprehensive multi-threaded runtime.
I have been fleshing out the first and simplest single-threaded hosted event loop model in
https://gist.github.com/guybedford/9f534c70dd4b450294bf27eed139153f, and also have a draft Emscripten prototype that is able to get the test suite including many of the net tests passing.
Towards a formal PR I have opened an initial discussion issue on the Tokio repo in
https://github.com/tokio-rs/tokio/issues/8194.
The Tokio maintainers seem open to this Emscripten target support, under the condition that there are clear maintainers for this target in Tokio. Currently myself, Hood Chatham and Ingvar Stepanyan would be able to take on this role.
I'm sharing this topic for any further feedback from the Emscripten maintainers and community on the design here and also to seek further collaborators that may be interested in reviewing and assisting with the maintenance of this target work, either formally or informally.