1 mod bindings {
2     wit_bindgen::generate!({
3         path: "../misc/component-async-tests/wit",
4         world: "round-trip-many",
5         async: true,
6     });
7 
8     use super::Component;
9     export!(Component);
10 }
11 
12 use bindings::{
13     exports::local::local::many::{Guest, Stuff},
14     local::local::many,
15 };
16 
17 struct Component;
18 
19 impl Guest for Component {
foo( a: String, b: u32, c: Vec<u8>, d: (u64, u64), e: Stuff, f: Option<Stuff>, g: Result<Stuff, ()>, ) -> ( String, u32, Vec<u8>, (u64, u64), Stuff, Option<Stuff>, Result<Stuff, ()>, )20     async fn foo(
21         a: String,
22         b: u32,
23         c: Vec<u8>,
24         d: (u64, u64),
25         e: Stuff,
26         f: Option<Stuff>,
27         g: Result<Stuff, ()>,
28     ) -> (
29         String,
30         u32,
31         Vec<u8>,
32         (u64, u64),
33         Stuff,
34         Option<Stuff>,
35         Result<Stuff, ()>,
36     ) {
37         let into = |v: Stuff| many::Stuff {
38             a: v.a,
39             b: v.b,
40             c: v.c,
41         };
42         let from = |v: many::Stuff| Stuff {
43             a: v.a,
44             b: v.b,
45             c: v.c,
46         };
47         let (a, b, c, d, e, f, g) = many::foo(
48             format!("{a} - entered guest"),
49             b,
50             c,
51             d,
52             into(e),
53             f.map(into),
54             g.map(into).map_err(drop),
55         )
56         .await;
57         (
58             format!("{a} - exited guest",),
59             b,
60             c,
61             d,
62             from(e),
63             f.map(from),
64             g.map(from),
65         )
66     }
67 }
68 
69 // Unused function; required since this file is built as a `bin`:
main()70 fn main() {}
71