Restructure lang support#44
Conversation
fbbc4b6 to
11a38c9
Compare
itowlson
left a comment
There was a problem hiding this comment.
LGTM except two small things that now need linking. Thanks!
| OK Successfully written add.wasm with imports (). | ||
| ``` | ||
|
|
||
| Now, run the component using the Rust `add` host: |
There was a problem hiding this comment.
This probably needs a link or other pointer to the Add host (previously the Add host was mentioned earlier on the same page but now that's split away).
| Component built successfully | ||
| ``` | ||
|
|
||
| To test the component, run it using the Rust `add` host: |
| [`cargo-component`](https://github.com/bytecodealliance/cargo-component) is a `cargo` subcommand for | ||
| creating WebAssembly components using Rust as the component's implementation language. | ||
|
|
||
| Let's create the same `add` component using the `cargo-component` tooling. First scaffold a project: |
There was a problem hiding this comment.
Someone could land on this page before the language-support.md page. Should we say "add function in the example
world" as we do in Python
| [`cargo-component`](https://github.com/bytecodealliance/cargo-component) is a `cargo` subcommand for | ||
| creating WebAssembly components using Rust as the component's implementation language. |
There was a problem hiding this comment.
This is redundant with the paragraph a few paragraphs above. I think we can remove this.
| [`cargo-component`](https://github.com/bytecodealliance/cargo-component) is a `cargo` subcommand for | |
| creating WebAssembly components using Rust as the component's implementation language. |
kate-goldenring
left a comment
There was a problem hiding this comment.
My comments echo Ivans. Just a couple small changes.
|
Think I addressed your comments @kate-goldenring and @itowlson. Sorry for the delay with addressing these... some other things grabbed my attention at the event. |
| $ npm install @bytecodealliance/componentize-js | ||
| ``` | ||
|
|
||
| Create a JavaScript module that implements the `add` function in [`add.wit`](../examples/example-host/add.wit): |
There was a problem hiding this comment.
I think this link (and others that reference this WIT in this PR) needs to be one parent directory higher. If you use VSCode, you could run this extension on each file you've changed to make sure the relative links are adjusted: https://marketplace.visualstudio.com/items?itemName=blackmist.LinkCheckMD
| Create a JavaScript module that implements the `add` function in [`add.wit`](../examples/example-host/add.wit): | |
| Create a JavaScript module that implements the `add` function in [`add.wit`](../../examples/example-host/add.wit): |
| application to a WebAssembly component. | ||
|
|
||
| Create a Python program that implements the `add` function in the [`example` | ||
| world](../examples/example-host/add.wit). Note that it imports the bindings that will be created by |
There was a problem hiding this comment.
| world](../examples/example-host/add.wit). Note that it imports the bindings that will be created by | |
| world](../../examples/example-host/add.wit). Note that it imports the bindings that will be created by |
|
|
||
| ```sh | ||
| $ pip install componentize-py | ||
| $ componentize-py -d ../examples/example-host/add.wit -w example componentize guest -o add.wasm |
There was a problem hiding this comment.
| $ componentize-py -d ../examples/example-host/add.wit -w example componentize guest -o add.wasm | |
| $ componentize-py -d /path/to/examples/example-host/add.wit -w example componentize guest -o add.wasm |
| ## Building a Component with `cargo component` | ||
|
|
||
| Create a Rust program that implements the `add` function in the [`example` | ||
| world](../examples/example-host/add.wit). Note that it imports the bindings that will be created by |
There was a problem hiding this comment.
| world](../examples/example-host/add.wit). Note that it imports the bindings that will be created by | |
| world](../../examples/example-host/add.wit). Note that it imports the bindings that will be created by |
| ### Running a Component from Rust Applications | ||
|
|
||
| To verify that our component works, lets run it from a Rust application that knows how to import a | ||
| component of the [`example` world](../examples/example-host/add.wit). |
There was a problem hiding this comment.
| component of the [`example` world](../examples/example-host/add.wit). | |
| component of the [`example` world](../../examples/example-host/add.wit). |
kate-goldenring
left a comment
There was a problem hiding this comment.
Thank you @macovedj!
Implements changes described here