Tag: wasm

A simple way to run Rust WebAssembly in a browser

The Rust WebAssemply bookcache has a detailed introduction to WebAssembly in Rust; unfortunately it's example setup is somewhat complicated and requires the use of npm just to run show a simple Hello World! message in the browser.

Luckily, there's a simpler way to get started if you don't care about npm modules.

First, follow the setup instructionscache to install the rust toolchain, wasm-pack and cargo-generate. You don't need npm.

Clone the example project template:

cargo generate --git https://github.com/rustwasm/wasm-pack-template

which will prompt you for a project name, in the following we'll assume you used browser-wasm …

© Julian Schrittwieser. Built using Pelican. Theme by Giulio Fidente on github. .