WebAssembly fulfills the long-awaited promise of web technologies: fast code, type-safe at compile time, execution in the browser, on embedded devices, or anywhere else. Rust delivers the power of C in a language that strictly enforces type safety. Combine both languages and you can write for the web like never before! Learn how to integrate with JavaScript, run code on platforms other than the browser, and take a step into IoT. Discover the easy way to build cross-platform applications without sacrificing power, and change the way you write code for the web. WebAssembly is more than just a revolutionary new technology. It's reshaping how we build applications for the web and beyond. Where technologies like ActiveX and Flash have failed, you can now write code in whatever language you prefer and compile to WebAssembly for fast, type-safe code that runs in the browser, on mobile devices, embedded devices, and more. Combining WebAssembly's portable, high-performance modules with Rust's safety and power is a perfect development combination. Learn how WebAssembly's stack machine architecture works, install low-level wasm tools, and discover the dark art of writing raw wast code. Build on that foundation and learn how to compile WebAssembly modules from Rust by implementing the logic for a checkers game. Create wasm modules in Rust to interoperate with JavaScript in many compelling ways. Apply your new skills to the world of non-web hosts, and create everything from an app running on a Raspberry Pi that controls a lighting system, to a fully-functioning online multiplayer game engine where developers upload their own arena-bound WebAssembly combat modules. Get started with WebAssembly today, and change the way you think about the web. What You Need: You'll need a Linux, Mac, or Windows workstation with an Internet connection. You'll need an up-to-date web browser that supports WebAssembly. To work with the sample code, you can use your favorite text editor or IDE. The bo
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
【One-Line Pitch】
A hands-on guide to WebAssembly that starts with raw bytecode and ends with Rust-powered modules running in browsers, on Raspberry Pis, and inside a multiplayer game engine. Best for developers who want to understand what happens beneath the tooling before they trust it.
【Book Arc】
- **Opening (~0%–10%)**: Frames WebAssembly as a portable, type-safe compilation target rather than a JavaScript replacement or a Flash successor, and clarifies what it is not.
- **Early (~10%–35%)**: Teaches the low-level stack machine, the text format (wast/wat), and the wabt toolchain, then builds a hand-written checkers module to internalize memory, globals, and control flow.
- **Middle (~35%–55%)**: Moves into Rust, compiles a first module, and rebuilds checkers in Rust with iterators, structs, and cleaner move-generation logic.
- **Late (~55%–80%)**: Covers JavaScript interop patterns and begins exploring non-browser hosts, including embedded and IoT scenarios.
- **Ending (~80%–100%)**: Culminates in a multiplayer arena game engine where developers upload WebAssembly combat modules, plus a Raspberry Pi lighting-control project.
【Key Takeaways】
- **WebAssembly is a portable compilation target, not a language or a JS transpile target** (Opening): it runs anywhere a host exists, which is why the book pushes beyond browser-only thinking.
- **Understanding the stack machine and raw wat pays off later** (Early): hand-writing checkers forces you to confront linear memory, bit-packed state, and type-safe control flow before compilers hide them.
- **Bit flags and idempotent operations matter in constrained memory** (Early): using `i32.or` instead of addition to set piece flags prevents state corruption, a lesson that transfers to any low-level wasm work.
- **Hand-coded wasm is dramatically smaller than generated wasm** (Middle): the checkers module compiles to 853 bytes and uses only 256 bytes of linear memory, showing the cost of tooling and code generation.
- **Rust brings safety and expressiveness to wasm without a garbage collector** (Middle): traits, generics, and iterators make complex game logic like move generation far more maintainable than raw wat.
- **JavaScript remains the host for WebAssembly 1.0 in the browser** (Late): interop is not optional, and the book treats JS integration as a core skill rather than an afterthought.
- **Non-browser hosts unlock IoT and embedded use cases** (Late): the Raspberry Pi lighting project demonstrates that wasm modules can control hardware, not just render UI.
- **A multiplayer arena engine shows wasm as a sandboxed plugin system** (Ending): developers upload combat modules, illustrating how wasm enables safe, portable user-generated code.
【Reading Tips】
- **Deep-read the raw wat chapters even if you plan to use Rust exclusively.** The book explicitly argues this foundation pays off when you later build non-browser hosts and need to parse or load modules.
- **Skim the checkers game rules if you already know them**, but study the data-structure constraints and bit-flag sections closely; they are the real lesson.
- **Treat the Rust checkers rebuild as a comparison exercise**: note what becomes easier (move generation, iterators) and what stays hard (memory layout, host interface).
- **Do not skip the interop and hosting chapters** if you care about IoT or plugin architectures; they are where the book moves from browser toy to practical platform.
- **Keep the wabt toolchain handy** (wat2wasm, wasm-objdump) and actually run the round-trip examples; the book assumes you will experiment, not just read.
【Coverage Limits】
The excerpts cover the book's conceptual arc, raw wat foundations, Rust checkers rebuild, and the non-browser/IoT direction, but do not include detailed chapter titles or the full JavaScript interop and multiplayer engine implementation. Specific API surfaces and later tooling chapters are only partially represented.
Excerpt 1
ux, Mac, or Windows workstation with an Internet connection. You'll need an up-to-date web browser that supports WebAssembly. To work with the sample code, y...
an arguably dense and detailed section of fairly low-level coding, I want to answer the question of why. Why should you spend the effort learning how to writ...
, and we need to specify an initial value. The $currentTurn global will be set to 1 when it is black’s turn and 2 when it is white’s turn. The following code...
n the previous chapter. The Rust version will also have the same concept of turns so that it can be played from a console or virtually any other kind of clie...
een spending nearly all of your time inside the WebAssembly module and little to no time working with the browser host. In the coming chapters, that’s going...
age type represents the data for a chat message. We use env.send_back() to dispatch a Msg: yew_wasmchat/src/lib.rs #![recursion_limit = "512"] extern crate s...
also maintain a win/loss count for a checkers module, etc. We now have a checkers runtime and a checkers import resolver. The two of these things can be enca...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
Programming WebAssembly with Rust (Kevin Hoffman) (Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
Programming WebAssembly with Rust (Kevin Hoffman) (Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
Loading comments...
Reply to Comment
Edit Comment