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
Copy file name to clipboardExpand all lines: component-model/src/language-support/importing-and-reusing-components/rust.md
+25-12Lines changed: 25 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,8 @@
5
5
The world file (`wit/world.wit`) we generated doesn't specify any imports.
6
6
If your component consumes other components, you can edit the `world.wit` file to import their interfaces.
7
7
8
-
For example, suppose you have created and built an adder component as explained in the [exporting an interface section](#exporting-an-interface-with-cargo-component) and want to use that component in a calculator component. Here is a partial example world for a calculator that imports the add interface:
8
+
For example, suppose you have created and built the adder component as explained in the earlier tutorials and want to use
9
+
that component in a calculator component. Here is a partial example world for a calculator that imports the add interface:
9
10
10
11
```wit
11
12
// in the 'calculator' project
@@ -18,8 +19,9 @@ interface calculate {
18
19
}
19
20
20
21
world calculator {
21
-
export calculate;
22
22
import docs:adder/add@0.1.0;
23
+
24
+
export calculate;
23
25
}
24
26
```
25
27
@@ -39,28 +41,39 @@ at the path that is given, and will pull its contents into the local project und
39
41
40
42
### Calling the import from Rust
41
43
42
-
Now the declaration of `add` in the adder's WIT file is visible to the `calculator` project. To invoke the imported `add` interface from the `calculate` implementation:
44
+
Now the declaration of `add` in the adder's WIT file is visible to the `calculator` project.
45
+
46
+
To invoke the imported `add` interface from the `calculate` implementation:
0 commit comments