Commit db99d22
authored
* Loosely integrate `implements` into `bindgen!`
This commit is the next step in fleshing out #12698 and following in the
footsteps of #13361 to integrate the `(implements ...)` directive into
`bindgen!`. Notably this world:
world foo {
import a: thing;
import b: thing;
}
will only generate a single trait for `thing::Host` as opposed to the
previous 2 traits that were generated. This enables hosts to use the
same trait implementation for both, or customize as appropriate.
Additionally the `add_to_linker`-generated methods for interfaces are
now refactored to additionally have an `add_to_linker_instance`
entrypoint. This new entrypoint takes a `LinkerInstance` instead of a
`Linker` and fills in the provided instance directly. This is in-turn
used to fill out a linker for the `foo` world above.
Notably, however, embedders can call `add_to_linker_instance` with
distinct closures accessing different parts of `T`, the store's state,
meaning that it's possible to have two distinct implementations for `a`
and `b` above.
Many golden tests were updated with this new `add_to_linker_instance`
method, and codegen/runtime tests were added for a simple world as well
showcasing the bindings modes that are possible. The (rarely used)
top-level world `add_to_linker` only uses a single trait implementation,
but invoking `add_to_linker_instance` enables passing in two separate
implementations.
* Hide generated files in diffs by default
* Add some runtime tests
1 parent 82a7bff commit db99d22
119 files changed
Lines changed: 3637 additions & 527 deletions
File tree
- crates
- component-macro
- src
- tests
- codegen
- expanded
- wit-bindgen/src
- tests/all/component_model
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
| 23 | + | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
46 | 51 | | |
47 | 52 | | |
48 | 53 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments