---
title: "Supporting native Rust in Workers with the new Emscripten target for wasm-bindgen"
description: "Cloudflare announced an experimental Emscripten target for wasm-bindgen, enabling native Rust code compiled with wasm-bindgen to run directly on Workers with full platform feature virtualization. This resolves the long-standing incompatibility between Emscripten and wasm-bindgen by having Emscripten drive the build while wasm-bindgen produces portable bindings included in Emscripten’s library system. The integration virtualizes timers, file system operations, and sockets atop Workers’ Node.js APIs, bringing significantly improved library compatibility for many previously unsupported Rust crates after minor patches to libraries like libc and socket2. Tokio async runtime support is achieved through WebAssembly JavaScript Promise Integration, which suspends blocking calls and returns control to the event loop without stalling. In testing, a Rust Minecraft server (Pumpkin) was deployed inside a Durable Object with TCP ingress using real Tokio sockets, persisting world state through Durable Object storage and supporting multiplayer connections."
---

# Supporting native Rust in Workers with the new Emscripten target for wasm-bindgen

[Cloudflare](https://yomu.fyi/company/cloudflare) · Mitch Foley · Sep 28, 2026

**Type:** Announcement

## Summary

Cloudflare announced an experimental Emscripten target for wasm-bindgen, enabling native Rust code compiled with wasm-bindgen to run directly on Workers with full platform feature virtualization. This resolves the long-standing incompatibility between Emscripten and wasm-bindgen by having Emscripten drive the build while wasm-bindgen produces portable bindings included in Emscripten’s library system. The integration virtualizes timers, file system operations, and sockets atop Workers’ Node.js APIs, bringing significantly improved library compatibility for many previously unsupported Rust crates after minor patches to libraries like libc and socket2. Tokio async runtime support is achieved through WebAssembly JavaScript Promise Integration, which suspends blocking calls and returns control to the event loop without stalling. In testing, a Rust Minecraft server (Pumpkin) was deployed inside a Durable Object with TCP ingress using real Tokio sockets, persisting world state through Durable Object storage and supporting multiplayer connections.

## Context

Rust-based WebAssembly on Workers used wasm-bindgen for JS bindings, but wasm-bindgen and Emscripten toolchains conflicted, preventing native Rust libraries that depend on platform features like timers and sockets from working. Users had to choose one toolchain, limiting compatibility.

## Approach / What changed

The approach introduces the wasm32-unknown-emscripten target for wasm-bindgen, allowing Emscripten to drive the build and generate the final JavaScript and Wasm output, while wasm-bindgen produces a portable version of its JavaScript bindings included in Emscripten’s library system. This enables cooperative use of both toolchains, with Emscripten virtualizing platform features on Workers’ Node.js APIs. For Tokio, JSPI bridges blocking operations without stalling the event loop.

## Takeaways

- The Emscripten target for wasm-bindgen resolves incompatibility between the two toolchains, allowing Rust code to benefit from Emscripten’s platform feature virtualization while using wasm-bindgen’s JS bindings.
- Tokio async runtime support on Workers is achieved through WebAssembly JavaScript Promise Integration, which suspends blocking calls and returns control to the JS event loop without stalling.
- Low-level Rust libraries like libc, socket2, and Mio required only minor target patches to add Emscripten support, and Tokio needed more extensive patchsets for JSPI integration.

## FAQ

### What does the Emscripten target for wasm-bindgen enable for Rust Workers?

It enables Rust code compiled with wasm-bindgen to run natively on Workers using Emscripten's platform feature virtualization, resolving the previous toolchain incompatibility and allowing many previously unsupported libraries to work.

### How does Tokio async runtime work on single-threaded Workers?

Tokio uses WebAssembly JavaScript Promise Integration (JSPI) to suspend blocking calls like socket reads and return control to the JS event loop, avoiding stalls. This requires careful thread-local context handling to separate runtime state between JSPI context switches.

### What demonstrations have been done with this new support?

A native Rust Minecraft server (Pumpkin) was deployed inside a Durable Object with TCP ingress, using real Tokio sockets. It persists world state through Durable Object storage and supports multiplayer connections, demonstrating full native compatibility.

**Tags:** [Cloudflare](https://yomu.fyi/topic/cloudflare), [Emscripten](https://yomu.fyi/topic/emscripten), [Rust](https://yomu.fyi/topic/rust), [wasm-bindgen](https://yomu.fyi/topic/wasm-bindgen), [Workers](https://yomu.fyi/topic/workers)

- Source: [Cloudflare](https://blog.cloudflare.com/rust-workers-emscripten-target)
- Source URL: https://blog.cloudflare.com/rust-workers-emscripten-target
- Ingested by Yomu: 2026-09-28T15:00:07.862Z

[Read original post](https://blog.cloudflare.com/rust-workers-emscripten-target)
