WASM Skill
Rust to WebAssembly scaffolds and interop - an Agent Skill for Rust 1.97.0 and browser or WASI deployments.
Busca en todas las páginas de la documentación
Rust to WebAssembly scaffolds and interop - an Agent Skill for Rust 1.97.0 and browser or WASI deployments.
Creates cdylib crates with wasm-bindgen, wasm-pack build, JS glue, and size-tuned release profiles. Reviews #[wasm_bindgen] exports and panic hooks for browser consoles.
| Input | Why |
|---|---|
| Target | wasm32-unknown-unknown vs wasi |
| JS framework | Raw bundler vs npm package |
| Exported API | Functions, classes, strings |
| Size budget | KB limit for CDN delivery |
Cargo.toml with crate-type = ["cdylib"]wasm-pack build scriptswee_alloc or default allocator choice documentedindex.html demo or npm pkg/ publish layouttwiggy or wasm-objdumpopt-level = "s" or "z" for size-sensitive WASM.Result in exports.wasm-pack build --target web --release
wasm-opt -Oz -o pkg/my_module_bg.wasm pkg/my_module_bg.wasmuse wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn add(a: u32, b: u32) -> u32 {
a + b
}wasm-bindgen for browsers; WASI for server-side WASM runtimes.
Generally no full Tokio; use wasm-bindgen-futures for browser async.
Strip debug, run wasm-opt, avoid pulling full serde where hand-rolled JS types suffice.
Stack versions: This page was written for Rust 1.97.0 (edition 2024), Tokio 1.x, Axum 0.8, serde 1.0, sqlx 0.8, clap 4, and Polars 0.46+.
Revisado por Chris St. John·Última actualización: 16 jul 2026