Skip to content

Commit 262207c

Browse files
Ali Somayesoterra
andauthored
Update rust guest example comments in README.md (#599)
* Update rust guest example comments in README.md * Shorten the explanations on export_host macro Co-authored-by: Kyle Brown <kylebrw@gmail.com> --------- Co-authored-by: Kyle Brown <kylebrw@gmail.com>
1 parent 0cc1e99 commit 262207c

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</strong>
1010
</p>
1111

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>
1313

1414
<p>
1515
<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).
157157
[non-command]: https://github.com/bytecodealliance/wasmtime/releases/latest/download/wasi_snapshot_preview1.reactor.wasm
158158
[command]: https://github.com/bytecodealliance/wasmtime/releases/latest/download/wasi_snapshot_preview1.command.wasm
159159

160-
161-
162160
## Supported Guest Languages
161+
163162
[guests]: #supported-guest-languages
164163

165164
The `wit-bindgen` project is primarily focused on **guest** languages which are
@@ -215,7 +214,7 @@ file. Example code using this then looks like:
215214
wit_bindgen::generate!("host");
216215

217216
// 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
219218
// component.
220219
struct MyHost;
221220

@@ -225,6 +224,7 @@ impl Host for MyHost {
225224
}
226225
}
227226

227+
// The following macro is generated by wit-bindgen and is always named `export_{world_name}`
228228
export_host!(MyHost);
229229
```
230230

@@ -301,7 +301,6 @@ Like with Rust, you can then inspect the output binary:
301301
wasm-tools component wit ./my-component.wasm
302302
```
303303

304-
305304
### Guest: Java
306305

307306
Java bytecode can be compiled to WebAssembly using
@@ -380,6 +379,7 @@ ideally relatively quickly follow suit and stay within the confines of the
380379
first design.
381380

382381
## CLI Installation
382+
383383
[cli-install]: #cli-installation
384384

385385
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
394394
being stable. Please reach out to us on [zulip] if you'd like to depend on it,
395395
so we can figure out a better alternative for your use case.
396396

397-
398397
## Host Runtimes for Components
398+
399399
[hosts]: #host-runtimes-for-components
400400

401401
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
404404
but these are some resources and runtimes which can help you work with
405405
components:
406406

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
408408
a native component runtime that can run any WIT `world`. It additionally comes
409409
with a [`bindgen!`
410410
macro](https://docs.rs/wasmtime/latest/wasmtime/component/macro.bindgen.html)
411411
which acts similar to the `generate!` macro in this repository. This macro
412412
takes a [WIT] package as input and generates `trait`-based bindings for the
413413
runtime to implement and use.
414414

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
416416
either on the web or outside the browser in a runtime such as `node`. This
417417
project generates a polyfill for a single concrete component to execute in a
418418
JS environment by extracting the core WebAssembly modules that make up a
419419
component and generating JS glue to interact between the host and these
420420
modules.
421421

422-
* Python: the [`wasmtime`](https://github.com/bytecodealliance/wasmtime-py)
422+
- Python: the [`wasmtime`](https://github.com/bytecodealliance/wasmtime-py)
423423
project [on PyPI](https://pypi.org/project/wasmtime/) has a `bindgen` mode
424424
that works similar to the JS integration. Given a concrete component this will
425425
generate Python source code to interact with the component using an embedding
426426
of Wasmtime for its core WebAssembly support.
427427

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
429429
low-level details of components. For example as previously mentioned you can
430430
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.
432432

433433
[`js-component-tools`]: https://github.com/bytecodealliance/js-component-tools
434434

0 commit comments

Comments
 (0)