Is possible to compile the std lib of Rust to WASM?

This page summarizes the projects mentioned and recommended in the original post on /r/rust

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • WASI

    WebAssembly System Interface

  • It is unfortunate there is not a better solution for more of std on wasm. A couple years ago for some time the Rust and WebAssembly working group was making a lot of progress: https://rustwasm.github.io but their blog stopped in 2019 and progress seems to have leveled off or interest waned. Emscripten accomplished a lot, but appears to be declining in popularity for Rust; wasm32-unknown-unknown works great but is minimal and requires implementing std replacements such as by using web-sys if you want to access the web platform, maybe wasm32-wasi will be the answer, you can follow its progress here: https://github.com/WebAssembly/WASI but their intended use case from my understanding is not necessarily for the web (though, that may be what you're looking for).

  • stevenarella

    Multi-protocol Minecraft-compatible client written in Rust

  • In my project I have a crate to replace std::fs, which stubs out the File calls on wasm, but otherwise re-exports std::fs. Not completely functional, but good enough to compile and get past initialization without panicking due to fs unavailability.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • rust

    Empowering everyone to build reliable and efficient software.

  • If you compile to wasm32-unknown-unknown, then your std comes from the library module defined here: https://github.com/rust-lang/rust/blob/master/library/std/src/sys/wasm/mod.rs

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts