You've already forked wit-bindgen
mirror of
https://github.com/AdaCore/wit-bindgen.git
synced 2026-02-12 13:12:42 -08:00
* Update Rust codegen for new WIT changes * Update the markdown generation for new WIT * more-rust * Update the C generator for new WIT * Get Rust guest tests compiling * Get rust host tests working * Get all C tests passing * Turn off teavm-java and Go tests for now * Fixup lockfile after rebase * Bump crate versions * Update dependency sources * Update to wasmtime dep
148 lines
2.3 KiB
Plaintext
148 lines
2.3 KiB
Plaintext
package foo:foo
|
|
|
|
interface variants {
|
|
enum e1 {
|
|
a,
|
|
}
|
|
|
|
e1-arg: func(x: e1)
|
|
e1-result: func() -> e1
|
|
|
|
union u1 {
|
|
u32,
|
|
float32,
|
|
}
|
|
|
|
u1-arg: func(x: u1)
|
|
u1-result: func() -> u1
|
|
|
|
record empty {}
|
|
|
|
variant v1 {
|
|
a,
|
|
b(u1),
|
|
c(e1),
|
|
d(string),
|
|
e(empty),
|
|
f,
|
|
g(u32),
|
|
}
|
|
|
|
v1-arg: func(x: v1)
|
|
v1-result: func() -> v1
|
|
|
|
bool-arg: func(x: bool)
|
|
bool-result: func() -> bool
|
|
|
|
option-arg: func(
|
|
a: option<bool>,
|
|
b: option<tuple<>>,
|
|
c: option<u32>,
|
|
d: option<e1>,
|
|
e: option<float32>,
|
|
f: option<u1>,
|
|
g: option<option<bool>>,
|
|
)
|
|
option-result: func() -> tuple<
|
|
option<bool>,
|
|
option<tuple<>>,
|
|
option<u32>,
|
|
option<e1>,
|
|
option<float32>,
|
|
option<u1>,
|
|
option<option<bool>>,
|
|
>
|
|
|
|
variant casts1 {
|
|
a(s32),
|
|
b(float32),
|
|
}
|
|
|
|
variant casts2 {
|
|
a(float64),
|
|
b(float32),
|
|
}
|
|
|
|
variant casts3 {
|
|
a(float64),
|
|
b(u64),
|
|
}
|
|
|
|
variant casts4 {
|
|
a(u32),
|
|
b(s64),
|
|
}
|
|
|
|
variant casts5 {
|
|
a(float32),
|
|
b(s64),
|
|
}
|
|
|
|
variant casts6 {
|
|
a(tuple<float32, u32>),
|
|
b(tuple<u32, u32>),
|
|
}
|
|
|
|
casts: func(
|
|
a: casts1,
|
|
b: casts2,
|
|
c: casts3,
|
|
d: casts4,
|
|
e: casts5,
|
|
f: casts6,
|
|
) -> tuple<
|
|
casts1,
|
|
casts2,
|
|
casts3,
|
|
casts4,
|
|
casts5,
|
|
casts6,
|
|
>
|
|
|
|
result-arg: func(
|
|
a: result,
|
|
b: result<_, e1>,
|
|
c: result<e1>,
|
|
d: result<tuple<>, tuple<>>,
|
|
e: result<u32, v1>,
|
|
f: result<string, list<u8>>,
|
|
)
|
|
result-result: func() -> tuple<
|
|
result,
|
|
result<_, e1>,
|
|
result<e1>,
|
|
result<tuple<>, tuple<>>,
|
|
result<u32, v1>,
|
|
result<string, list<u8>>,
|
|
>
|
|
|
|
enum my-errno {
|
|
bad1,
|
|
bad2,
|
|
}
|
|
|
|
return-result-sugar: func() -> result<s32, my-errno>
|
|
return-result-sugar2: func() -> result<_, my-errno>
|
|
return-result-sugar3: func() -> result<my-errno, my-errno>
|
|
return-result-sugar4: func() -> result<tuple<s32, u32>, my-errno>
|
|
return-option-sugar: func() -> option<s32>
|
|
return-option-sugar2: func() -> option<my-errno>
|
|
|
|
result-simple: func() -> result<u32, s32>
|
|
|
|
record is-clone {
|
|
v1: v1,
|
|
}
|
|
|
|
is-clone-arg: func(a: is-clone)
|
|
is-clone-return: func() -> is-clone
|
|
|
|
return-named-option: func() -> (a: option<u8>)
|
|
return-named-result: func() -> (a: result<u8, my-errno>)
|
|
}
|
|
|
|
world my-world {
|
|
import variants
|
|
export variants
|
|
}
|