finds.dev← search

// the find

koute/stdweb

★ 3,451 · Rust · Apache-2.0 · updated Feb 2024

A standard library for the client-side Web

stdweb is a Rust library for writing client-side web code, predating wasm-bindgen. It lets you call JavaScript from Rust via a js!{} macro and exposes typed bindings for browser APIs like DOM, XHR, WebSocket, and Canvas. It was the main option for Rust-in-the-browser before the current ecosystem solidified.

The js!{} macro with variable interpolation is genuinely ergonomic — embedding JS snippets with @{rust_var} is cleaner than the ceremony wasm-bindgen requires for the same thing. The typed Web API bindings are thorough: events, canvas, XHR, WebSocket, file APIs, gamepad, pointer events — most of the surface area is covered. Serde integration for marshaling arbitrary structs across the Rust/JS boundary works well and was ahead of its time. The design decision to separate the runtime JS shim from the Rust code meant it supported both Emscripten and native wasm targets before wasm-bindgen existed.

This project is effectively dead — last meaningful activity was 2020, last push was a minor compatibility fix in 2024. wasm-bindgen plus web-sys has won and is the de facto standard; stdweb is not compatible with that ecosystem and the two can't be mixed easily. The required cargo-web toolchain is also unmaintained and won't build on current Rust without workarounds. The js!{} macro approach means JS code is strings at compile time — no TypeScript types, no tree-shaking, no IDE support for the embedded JS fragments.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →