22
33🟪 Rust library compiled to WASM and distributed as a [ WASM component]
44
5- <table align =center ><td >
6-
7- ``` js
8- run ();
9- // => Hello Alan Turing!
10-
11- console .log (getReport ());
12- // => {
13- // bouncyCastles: 100,
14- // funPercent: 0.9,
15- // catCount: 8,
16- // unicornNames: [ 'Fluffy', 'Marshmallow', 'Sparkles' ]
17- // }
18-
19- console .log (computeArea ({ center: { x: 0 , y: 0 }, radius: 6 }));
20- // => 113.09733552923255
21-
22- console .log (greetMany ([" Alan Turing" , " Ada Lovelace" ]));
23- // => Hello, Alan Turing!
24- // Hello, Ada Lovelace!
25- ```
26-
27- </table >
5+ <p align =center >
6+ <a href =" https://github.com/jcbhmr/hello-world-rust-wasm-component-lib/releases/latest/download/hello-world-rust-wasm-component-lib.wasm " >Download WASM</a >
7+ | <a href =" https://github.com/jcbhmr/hello-world-rust-wasm-component-lib/tree/main/wit " >View WIT</a >
8+ | <a href =" https://github.com/jcbhmr/hello-world-rust-wasm-component-lib.js " >JavaScript bindings</a >
9+ </p >
2810
2911🦀 Written in Rust \
30- [ 🟨 Usable in JavaScript] ( ./hello-world-rust-wasm-lib-component.js/ ) \
31- 🌎 Runs on any [ WebAssembly Component Runtime]
32-
33- ## Installation
34-
35- ![ WebAssembly] ( https://img.shields.io/static/v1?style=for-the-badge&message=WebAssembly&color=654FF0&logo=WebAssembly&logoColor=FFFFFF&label= )
36- ![ JavaScript] ( https://img.shields.io/static/v1?style=for-the-badge&message=JavaScript&color=222222&logo=JavaScript&logoColor=F7DF1E&label= )
37-
38- The easiest way to get started is by using one of these wrapper libraries that
39- already have all of the WASM host imports resolved.
40-
41- For JavaScript users, you can use npm, [ pnpm] , [ Yarn] , or your other favorite
42- npm package manager to install [ ` hello-world-rust-wasm-lib-component ` from npm] .
43-
44- ``` sh
45- npm install hello-world-rust-wasm-lib-component
46- ```
47-
48- If you prefer to customize the Javascript ↔ WASM component bindings, you can
49- use [ bytecodealliance/jco] to generate your own bindings.
12+ 🟪 Modern WebAssembly Component example \
13+ 🌎 Runs on any [ WebAssembly Component Runtime] \
14+ 📥 Imports some host functions \
15+ 📤 Exports some functions \
16+ 👩⚖️ [ 0BSD licensed] template
5017
5118## Usage
5219
5320![ WebAssembly] ( https://img.shields.io/static/v1?style=for-the-badge&message=WebAssembly&color=654FF0&logo=WebAssembly&logoColor=FFFFFF&label= )
54- ![ JavaScript] ( https://img.shields.io/static/v1?style=for-the-badge&message=JavaScript&color=222222&logo=JavaScript&logoColor=F7DF1E&label= )
5521
56- You can use any [ WASM host runtime for components] . You can find the API surface
57- and any imports you need to provide in [ ` wit/world.wit ` ] ( wit/world.wit ) .
58-
59- For language-specific binding documentation, check out
60- [ hello-world-rust-wasm-lib-component.js] .
22+ To get started just [ download the latest WASM artifact] and use it in your
23+ favorite [ WebAssembly Component Runtime] ! Make sure you provide any required
24+ imports! 😉
6125
6226## Development
6327
6428![ Rust] ( https://img.shields.io/static/v1?style=for-the-badge&message=Rust&color=000000&logo=Rust&logoColor=FFFFFF&label= )
6529![ WebAssembly] ( https://img.shields.io/static/v1?style=for-the-badge&message=WebAssembly&color=654FF0&logo=WebAssembly&logoColor=FFFFFF&label= )
6630
6731``` sh
68- ./build.sh
69- ./build.sh --release
32+ ./just build:debug
7033```
7134
7235ℹ You'll need [ ` wasm-tools ` ] installed which you can get via
@@ -85,22 +48,12 @@ used to choose the `v${version}` tag name for the release and in publishing.
8548Also try not to change the artifacts attached to the draft release; they were
8649generated by GitHub Actions.
8750
88- <!-- prettier-ignore -->
89- ✅ JavaScript: [ jcbhmr/hello-world-rust-wasm-lib-component/hello-world-rust-wasm-lib-component.js] ( https://github.com/jcbhmr/hello-world-rust-wasm-lib-component/tree/main/hello-world-rust-wasm-lib-component.js ) \
90- ❌ Python \
91- ❌ Rust
92-
9351<!-- prettier-ignore-start -->
94- [ WASM host runtime for components ] : https://github.com/bytecodealliance/wit-bindgen#host-runtimes-for-components
9552[ webassembly component runtime ] : https://github.com/bytecodealliance/wit-bindgen#host-runtimes-for-components
96- [ bytecodealliance/jco ] : https://github.com/bytecodealliance/jco
97- [ bytecodealliance/wasm-tools ] : https://github.com/bytecodealliance/wasm-tools
9853[ wasm component ] : https://github.com/WebAssembly/component-model
9954[ `wasm-tools` ] : https://github.com/bytecodealliance/wasm-tools
10055[ bytecodealliance/wasmtime releases ] : https://github.com/bytecodealliance/wasmtime/releases
10156[ draft release ] : https://github.com/jcbhmr/hello-world-wasm-component/actions/workflows/draft-release.yml
102- [ hello-world-rust-wasm-lib-component.js ] : https://github.com/jcbhmr/hello-world-rust-wasm-lib-component/tree/main/hello-world-rust-wasm-lib-component.js
103- [ yarn ] : https://yarnpkg.com/
104- [ pnpm ] : https://pnpm.io/
105- [ `hello-world-rust-wasm-lib-component` from npm ] : https://www.npmjs.com/package/hello-world-rust-wasm-lib-component
57+ [ download the latest WASM artifact ] : https://github.com/jcbhmr/hello-world-rust-wasm-component-lib/releases/latest/download/hello-world-rust-wasm-component-lib.wasm
58+ [ 0bsd licensed ] : https://github.com/jcbhmr/hello-world-rust-wasm-component-lib/blob/main/LICENSE
10659<!-- prettier-ignore-end -->
0 commit comments