@@ -43,7 +43,7 @@ below][hosts].
4343
4444The ` wit-bindgen ` project extensively uses [ WIT] definitions to describe imports
4545and exports. The items supported by [ WIT] directly map to the component model
46- which allows core WebAssembly binaries produce by native compilers to be
46+ which allows core WebAssembly binaries produced by native compilers to be
4747transformed into a component. All imports into a WebAssembly binary and all
4848exports must be described with [ WIT] . An example file looks like:
4949
@@ -180,13 +180,13 @@ The Rust compiler supports a native `wasm32-wasi` target and can be added to any
180180` rustup ` -based toolchain with:
181181
182182``` sh
183- $ rustup target add wasm32-wasi
183+ rustup target add wasm32-wasi
184184```
185185
186186Projects can then depend on ` wit-bindgen ` by executing:
187187
188188``` sh
189- $ cargo add --git https://github.com/bytecodealliance/wit-bindgen wit-bindgen-guest-rust
189+ cargo add --git https://github.com/bytecodealliance/wit-bindgen wit-bindgen-guest-rust
190190```
191191
192192WIT files are currently added to a ` wit/ ` folder adjacent to your ` Cargo.toml `
@@ -219,8 +219,8 @@ doc` you can also explore the generated code.
219219This project can then be built with:
220220
221221``` sh
222- $ cargo build - --target wasm32-wasi
223- $ wasm-tools component new ./target/wasm32-wasi/debug/my-project.wasm \
222+ cargo build --target wasm32-wasi
223+ wasm-tools component new ./target/wasm32-wasi/debug/my-project.wasm \
224224 -o my-component.wasm --adapt ./wasi_snapshot_preview1.wasm
225225```
226226
@@ -229,11 +229,11 @@ component runtime. Using `wasm-tools` you can inspect the binary as well, for
229229example inferring the WIT world that is the component:
230230
231231``` sh
232- $ wasm-tools component wit my-component.wasm
233- default world my-component {
234- import print: func(msg: string)
235- export run: func ()
236- }
232+ wasm-tools component wit my-component.wasm
233+ # default world my-component {
234+ # import print: func(msg: string)
235+ # export run: func()
236+ # }
237237```
238238
239239which in this case, as expected, is the same as the input world.
@@ -251,10 +251,10 @@ project to use. These files are generated with the [`wit-bindgen` CLI
251251command] [ cli-install ] in this repository.
252252
253253``` sh
254- $ wit-bindgen c ./wit
255- Generating " host.c"
256- Generating " host.h"
257- Generating " host_component_type.o"
254+ wit-bindgen c ./wit
255+ # Generating "host.c"
256+ # Generating "host.h"
257+ # Generating "host_component_type.o"
258258```
259259
260260Some example code using this would then look like
@@ -276,14 +276,14 @@ This can then be compiled with `clang` from the [WASI SDK] and assembled into a
276276component with:
277277
278278``` sh
279- $ clang host.c host_component_type.o my-component.c -o my-core.wasm -mexec-model=reactor
280- $ wasm-tools component new ./my-core.wasm -o my-component.wasm
279+ clang host.c host_component_type.o my-component.c -o my-core.wasm -mexec-model=reactor
280+ wasm-tools component new ./my-core.wasm -o my-component.wasm
281281```
282282
283283Like with Rust, you can then inspect the output binary:
284284
285285``` sh
286- $ wasm-tools component wit ./my-component.wasm
286+ wasm-tools component wit ./my-component.wasm
287287```
288288
289289
0 commit comments