We abide by the Rust Code of Conduct and ask that you do as well.
-
src/lib.rs: Main entry point for the Rust crate. -
index.html: Root HTML page that loads the JS and Wasm. -
index.js: Root JS module, imports thewasm-bindgen-generated JS interface to the Rust's Wasm, and transitively loads the Wasm itself. -
tests/: Rust tests for native code. -
benches/: Rust benchmarks for native code. -
webpack.config.js: Webpack configuration. -
ci/: Continuous integration scripts.
To build the crate for the native target, run
cargo build
or
cargo build --release
To build just the .wasm binary, run
cargo build --target wasm32-unknown-unknown
or
cargo build --target wasm32-unknown-unknown --release
First, ensure that you've installed Webpack locally by running this command within the repository:
npm install
Then, to build the optimized WebAssembly, the wasm-bindgen JS interface to it,
and the JavaScript bundle using the JS interface, run:
npm run build
-
wee_alloc: Enable usingwee_allocas the global allocator. This trades allocation speed for smaller code size. -
console_error_panic_hook: Enable better debugging of panics by printing error messages in browser devtools withconsole.error.
Ensure that you have installed Webpack and its development server by running this command within the repository:
npm install
After that, you can start a local server on http://localhost:8080 by running this command:
npm run serve
There are integration tests in the tests/ directory, and unit tests in
#[cfg(test)] modules within the crate itself.
To run all the tests, run
cargo test
Benchmarks live within the benches/ directory.
To run all benchmarks, run
cargo bench
Ensure that you have the rustfmt-preview component installed in rustup:
rustup component add rustfmt-preview
To format all of the code in the crate, run
cargo fmt