You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -118,43 +118,10 @@ Rust bindings, bring in WASI worlds, and execute the component.
118
118
119
119
```sh
120
120
$ cd examples/example-host
121
-
$ cargo run --release -- 1 2 ../add/target/wasm32-wasip1/release/add.wasm
121
+
$ cargo run --release -- 1 2 ../add/target/wasm32-wasip1/release/adder.wasm
122
122
1 + 2 = 3
123
123
```
124
124
125
-
## Exporting an interface with `cargo component`
126
-
127
-
The [sample `add.wit` file](https://github.com/bytecodealliance/component-docs/tree/main/component-model/examples/example-host/add.wit) exports a function. However, you'll often prefer to export an interface, either to comply with an existing specification or to capture a set of functions and types that tend to go together. For example, to implement the following world:
// Separating out the interface puts it in a sub-module
147
-
usebindings::exports::docs::adder::add::Guest;
148
-
149
-
structComponent;
150
-
151
-
implGuestforComponent {
152
-
fnadd(x:u32, y:u32) ->u32 {
153
-
x+y
154
-
}
155
-
}
156
-
```
157
-
158
125
## Importing an interface with `cargo component`
159
126
160
127
The world file (`wit/world.wit`) generated for you by `cargo component new --lib` doesn't specify any imports.
@@ -234,7 +201,8 @@ world root {
234
201
}
235
202
```
236
203
237
-
As the import is unfulfilled, the `calculator.wasm` component could not run by itself in its current form. To fulfill the `add` import, so that only `calculate` is exported, you would need to [compose the `calculator.wasm` with some `exports-add.wasm` into a single, self-contained component](../creating-and-consuming/composing.md).
204
+
As the import is unfulfilled, the `calculator.wasm` component could not run by itself in its current form. To fulfill the `add` import, so that
205
+
only `calculate` is exported, you would need to [compose the `calculator.wasm` with some `adder.wasm` into a single, self-contained component](../creating-and-consuming/composing.md).
238
206
239
207
## Creating a command component with `cargo component`
0 commit comments