Interaction with real-world JavaScript from compiled Rust
summary
Rust targets asm.js and WebAssembly and the talk demonstrates concrete interop steps: compile via LLVM/Emscripten, export functions with no_mangle and C ABI, and use no_exit_runtime to keep a module alive. A macro implements an EM_ASM macro–style bridge to embed JS strings; a binding layer registers types, boxes Rust objects as pointers for JS, and maintains a numeric handle table to avoid GC issues. A custom serializer roundtrips complex values; JSON-path is about four times slower than native JSON.parse, and the code runs in browser and Node (repo linked).
AI-written summary · about
chapters (13)
- 0:00Intro
- 0:43JavaScript: true cross-platform target
- 3:59Rust (LLVM)
- 4:20Emscripten + Rust
- 9:52Exporting functions
- 10:45Generated code (asm.js)
- 11:26Optimized code (asm.js)
- 12:58Optimized code (WASM)
- 14:38Memory model
- 17:17Calling JavaScript
- 31:00_embind_register_
- 34:30Garbage collection
- 36:49Speed (2.8M JSON)
related talks
30mRust in the Browser for Javascripters:New Frontiers,New Possibilities
39mWebAssembly for the rest of us
41mLet's build with WebAssembly!
23mLearnable Programming with Rust
46mA State Of WebAssembly - The Browser is now a real VM
41mCreating High-Performance Web Apps with WebAssembly
22mExtending JavaScript with Rust
44mOut of the JavaScript Box: Front-End Rust Programming
