Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fil1994/rust-wasm-template
a template for Rust WASM and webpack
https://github.com/fil1994/rust-wasm-template
rust wasm web-assembly webpack
Last synced: 3 days ago
JSON representation
a template for Rust WASM and webpack
- Host: GitHub
- URL: https://github.com/fil1994/rust-wasm-template
- Owner: FIL1994
- Created: 2018-01-22T19:23:24.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-22T19:44:31.000Z (almost 7 years ago)
- Last Synced: 2024-10-24T08:31:08.571Z (3 months ago)
- Topics: rust, wasm, web-assembly, webpack
- Language: JavaScript
- Size: 12.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rust-WASM-Template
NOTE: this is for windows only
## Use Rust Nightly
```
rustup toolchain install nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
rustup default nightly
```functions accessible to WebAssmebly need to be marked with #[no_mangle]
## Using NPM
```
npm install
// build project
npm run build
// run project
npm run start
```## Getting WASM
```
// es7 async await
(
async () => {
let importObject;
const res = await fetch('wasm_test.wasm');
const bytes = await res.arrayBuffer();
const results = await WebAssembly.instantiate(bytes, importObject);const {add, subtract, loop_add} = results.instance.exports;
}
)();
```