/fst-wasm

My first WebAssembly project with Rust.

Primary LanguageRust

fst-wasm

This is my first try with WebAssembly through Rust. index.html returns the factorial of 5.

Execution

Simply open the index.html file to see the application running.

Retrace

In order to obtain the .wasm files I ran a few commands in the following order:

rustc +nightly --target wasm32-unknown-unknown -O factorial.rs --crate-type=cdylib

Which generates a WebAssembly (.wasm) file of the same name as the original Rust file.

wasm-gc factorial.rs small-factorial.wasm

factorial.rs has been created in the prior step. Now wasm-gc helps us minimize the code, for instance, by removing unused code. The resulting file will be named as stated in the second argument, here small-factorial.wasm.

Needed tools

References