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