Interactive WASM Demos with egui
Embedding interactive Rust-based WASM demos in a static site using egui, Trunk, and Zola. This site embeds interactive Rust applications compiled to WebAssembly directly in static pages. Here’s how it works. Each demo is a standalone Cargo crate compiled to WASM with Trunk: A demo crate needs Demos embed via a Zola shortcode that renders a lazy-loading iframe. The WASM bundle only loads when the user clicks Load Demo. Example of a simple calculator is shown below: Setup
crate-type = ["cdylib"], plus eframe and egui as dependencies. The HTML entry point is a single <canvas> element that Trunk wires up automatically. Embedding