Add a wasmtime::component::bindgen! macro (#5317)

* Import Wasmtime support from the `wit-bindgen` repo

This commit imports the `wit-bindgen-gen-host-wasmtime-rust` crate from
the `wit-bindgen` repository into the upstream Wasmtime repository. I've
chosen to not import the full history here since the crate is relatively
small and doesn't have a ton of complexity. While the history of the
crate is quite long the current iteration of the crate's history is
relatively short so there's not a ton of import there anyway. The
thinking is that this can now continue to evolve in-tree.

* Refactor `wasmtime-component-macro` a bit

Make room for a `wit_bindgen` macro to slot in.

* Add initial support for a `bindgen` macro

* Add tests for `wasmtime::component::bindgen!`

* Improve error forgetting `async` feature

* Add end-to-end tests for bindgen

* Add an audit of `unicase`

* Add a license to the test-helpers crate

* Add vet entry for `pulldown-cmark`

* Update publish script with new crate

* Try to fix publish script

* Update audits

* Update lock file
This commit is contained in:
Alex Crichton
2022-12-06 13:06:00 -06:00
committed by GitHub
parent 293bb5b334
commit 2329ecc341
43 changed files with 4336 additions and 1212 deletions

View File

@@ -0,0 +1,84 @@
interface lists {
list-u8-param: func(x: list<u8>)
list-u16-param: func(x: list<u16>)
list-u32-param: func(x: list<u32>)
list-u64-param: func(x: list<u64>)
list-s8-param: func(x: list<s8>)
list-s16-param: func(x: list<s16>)
list-s32-param: func(x: list<s32>)
list-s64-param: func(x: list<s64>)
list-float32-param: func(x: list<float32>)
list-float64-param: func(x: list<float64>)
list-u8-ret: func() -> list<u8>
list-u16-ret: func() -> list<u16>
list-u32-ret: func() -> list<u32>
list-u64-ret: func() -> list<u64>
list-s8-ret: func() -> list<s8>
list-s16-ret: func() -> list<s16>
list-s32-ret: func() -> list<s32>
list-s64-ret: func() -> list<s64>
list-float32-ret: func() -> list<float32>
list-float64-ret: func() -> list<float64>
tuple-list: func(x: list<tuple<u8, s8>>) -> list<tuple<s64, u32>>
string-list-arg: func(a: list<string>)
string-list-ret: func() -> list<string>
tuple-string-list: func(x: list<tuple<u8, string>>) -> list<tuple<string, u8>>
string-list: func(x: list<string>) -> list<string>
record some-record {
x: string,
y: other-record,
z: list<other-record>,
c1: u32,
c2: u64,
c3: s32,
c4: s64,
}
record other-record {
a1: u32,
a2: u64,
a3: s32,
a4: s64,
b: string,
c: list<u8>,
}
record-list: func(x: list<some-record>) -> list<other-record>
record-list-reverse: func(x: list<other-record>) -> list<some-record>
variant some-variant {
a(string),
b,
c(u32),
d(list<other-variant>),
}
variant other-variant {
a,
b(u32),
c(string),
}
variant-list: func(x: list<some-variant>) -> list<other-variant>
type load-store-all-sizes = list<tuple<
string,
u8,
s8,
u16,
s16,
u32,
s32,
u64,
s64,
float32,
float64,
char,
>>
load-store-everything: func(a: load-store-all-sizes) -> load-store-all-sizes
}
world the-lists {
import import-lists: lists
export export-lists: lists
default export lists
}