9
9
</strong>
10
10
</p >
11
11
12
- <strong >A <a href =" https://bytecodealliance.org/ " >Bytecode Alliance</a > project</strong >
12
+ <strong >A <a href =" https://bytecodealliance.org/ " >Bytecode Alliance</a > project</strong >
13
13
14
14
<p >
15
15
<a href="https://github.com/bytecodealliance/wit-bindgen/actions?query=workflow%3ACI"><img src="https://github.com/bytecodealliance/wit-bindgen/workflows/CI/badge.svg" alt="build status" /></a>
@@ -157,9 +157,8 @@ which has a `_start` entrypoint (e.g. a `src/main.rs` in Rust).
157
157
[ non-command ] : https://github.com/bytecodealliance/wasmtime/releases/latest/download/wasi_snapshot_preview1.reactor.wasm
158
158
[ command ] : https://github.com/bytecodealliance/wasmtime/releases/latest/download/wasi_snapshot_preview1.command.wasm
159
159
160
-
161
-
162
160
## Supported Guest Languages
161
+
163
162
[ guests ] : #supported-guest-languages
164
163
165
164
The ` wit-bindgen ` project is primarily focused on ** guest** languages which are
@@ -215,7 +214,7 @@ file. Example code using this then looks like:
215
214
wit_bindgen :: generate! (" host" );
216
215
217
216
// Define a custom type and implement the generated `Host` trait for it which
218
- // represents implementing all the necesssary exported interfaces for this
217
+ // represents implementing all the necessary exported interfaces for this
219
218
// component.
220
219
struct MyHost ;
221
220
@@ -225,6 +224,7 @@ impl Host for MyHost {
225
224
}
226
225
}
227
226
227
+ // The following macro is generated by wit-bindgen and is always named `export_{world_name}`
228
228
export_host! (MyHost );
229
229
```
230
230
@@ -301,7 +301,6 @@ Like with Rust, you can then inspect the output binary:
301
301
wasm-tools component wit ./my-component.wasm
302
302
```
303
303
304
-
305
304
### Guest: Java
306
305
307
306
Java bytecode can be compiled to WebAssembly using
@@ -380,6 +379,7 @@ ideally relatively quickly follow suit and stay within the confines of the
380
379
first design.
381
380
382
381
## CLI Installation
382
+
383
383
[ cli-install ] : #cli-installation
384
384
385
385
To install the CLI for this tool (which isn't the only way it can be used), run
@@ -394,8 +394,8 @@ This CLI **IS NOT** stable and may change, do not expect it to be or rely on it
394
394
being stable. Please reach out to us on [ zulip] if you'd like to depend on it,
395
395
so we can figure out a better alternative for your use case.
396
396
397
-
398
397
## Host Runtimes for Components
398
+
399
399
[ hosts ] : #host-runtimes-for-components
400
400
401
401
The ` wit-bindgen ` project is intended to facilitate in generating a component,
@@ -404,31 +404,31 @@ execute that somewhere. This is not under the purview of `wit-bindgen` itself
404
404
but these are some resources and runtimes which can help you work with
405
405
components:
406
406
407
- * Rust: the [ ` wasmtime ` crate] ( https://docs.rs/wasmtime ) is an implementation of
407
+ - Rust: the [ ` wasmtime ` crate] ( https://docs.rs/wasmtime ) is an implementation of
408
408
a native component runtime that can run any WIT ` world ` . It additionally comes
409
409
with a [ ` bindgen! `
410
410
macro] ( https://docs.rs/wasmtime/latest/wasmtime/component/macro.bindgen.html )
411
411
which acts similar to the ` generate! ` macro in this repository. This macro
412
412
takes a [ WIT] package as input and generates ` trait ` -based bindings for the
413
413
runtime to implement and use.
414
414
415
- * JS: the [ ` js-component-tools ` ] project can be used to execute components in JS
415
+ - JS: the [ ` js-component-tools ` ] project can be used to execute components in JS
416
416
either on the web or outside the browser in a runtime such as ` node ` . This
417
417
project generates a polyfill for a single concrete component to execute in a
418
418
JS environment by extracting the core WebAssembly modules that make up a
419
419
component and generating JS glue to interact between the host and these
420
420
modules.
421
421
422
- * Python: the [ ` wasmtime ` ] ( https://github.com/bytecodealliance/wasmtime-py )
422
+ - Python: the [ ` wasmtime ` ] ( https://github.com/bytecodealliance/wasmtime-py )
423
423
project [ on PyPI] ( https://pypi.org/project/wasmtime/ ) has a ` bindgen ` mode
424
424
that works similar to the JS integration. Given a concrete component this will
425
425
generate Python source code to interact with the component using an embedding
426
426
of Wasmtime for its core WebAssembly support.
427
427
428
- * Tooling: the [ ` wasm-tools ` ] project can be used to inspect and modify
428
+ - Tooling: the [ ` wasm-tools ` ] project can be used to inspect and modify
429
429
low-level details of components. For example as previously mentioned you can
430
430
inspect the WIT-based interface of a component with `wasm-tools component
431
- wit` . You can link two components together with ` wasm-tools compose` as well.
431
+ wit` . You can link two components together with ` wasm-tools compose` as well.
432
432
433
433
[ `js-component-tools` ] : https://github.com/bytecodealliance/js-component-tools
434
434
0 commit comments