Skip to content

Latest commit

 

History

History

#16-hello-rust

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Minimal Rust & WebAssembly example. More examples: https://www.hellorust.com.

Install

  • Install rust.

  • Install WebAssembly target

rustup update
rustup component add wasm32-unknown-unknown --toolchain nightly
  • Install wasm-gc (works better than wasm-opt from binaryen)
cargo install --git https://github.com/alexcrichton/wasm-gc

Build

rustc +nightly --target wasm32-unknown-unknown -O hello.rs --crate-type=cdylib
wasm-gc hello.wasm hello-gc.wasm

Run

node index.js