/Rust-TypeScript-Wasm-Template

A base template with rust, typescript, wasm, mocha, webpack, etc

Primary LanguageJavaScriptMIT No AttributionMIT-0

Rust Wasm Template

When I started messing arround with Rust and webassembly I found the good Rust documentation, however it did not cover everything that I needed. In particular I had a really bad time getting wasm to run inside a test environment. After many hours of relentless and merciless battle I managed to get it to work. This is a template repository with the basic boiler-plate.

There is pretty much nothing about unit testing hybrid js/wasm code in the internet (at least that I could find). So I hope this can be helpful to somebody ;)

Any questions/suggestions feel free to open an issue/pull request.

How to use

  1. Clone this repo
  2. Have the rust toolchain installed
  3. Have wasm-pack installed
  4. Run yarn install. If you dont have it, you can get it here
  5. Run wasm-pack build
  6. Run yarn link inside the pkg folder
  7. Run yarn link ilovewasm on the project root (this is the project name on the config.toml file)
  8. Run yarn run dev-server
  9. Go to http://localhost:8080/

To run the test suite do the steps 1 to 7 above and then:

  1. Run yarn runtest-server
  2. Go to http://localhost:8080/test.html

About Rust -> Wasm

Checkout this for a simple (yet complete) tutorial of how to make a Conway's Game of Life using rust/wasm and some javascript. A more indepth and broad tutorial is available here.

License

This is available under the MIT-0 license. See LICENSE for more information.

TLDR: Use it for whatever you wan't, don't bother with attribution.