Skip to content

Comment on Rust 1.39parent

Comments

It's a pleasant suprise how easy targeting wasm is from Rust. Just pass on the right `--target` flag to `cargo build` if you have the toolchain installed.

And installing the right target is typically as simple as:

    rustup target add wasm32-unknown-unknown
Targeting browser APIs is a little more involved, generally requiring either:
    cargo install cargo-web
    cargo web build [...]
for stdweb, or for web-sys:
    cargo install wasm-pack
    wasm-pack build [...]

In all fairness, `GOARCH=wasm GOOS=js go build` is just as easy.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.