How to install
This example requires a nightly version of Rust to enable WebAssembly atomics and to recompile the standard library with atomics enabled.
Note the flags set to configure that in .cargo/config.toml.
This allows Rust to used shared memory and have the audio thread directly read / write to shared memory like a native platform.
To use shared memory the browser requires a specific 'CORS' configuration on the server-side.
Note the flags set to configure that in Trunk.toml.
trunk is used to build and serve the example.
cargo install --locked trunk
# -- or --
cargo binstall trunk
How to run in debug mode
# Builds the project and opens it in a new browser tab. Auto-reloads when the project changes.
trunk serve --open
How to build in release mode
# Builds the project in release mode and places it into the `dist` folder.
trunk build --release
What does each file do?
-
Cargo.tomlcontains the standard Rust metadata. You put your Rust dependencies in here. You must change this file with your details (name, description, version, authors, categories) -
The
srcfolder contains your Rust code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|