1 /// Auto-generated bindings for a pre-instantiated version of a
2 /// component which implements the world `the-flags`.
3 ///
4 /// This structure is created through [`TheFlagsPre::new`] which
5 /// takes a [`InstancePre`](wasmtime::component::InstancePre) that
6 /// has been created through a [`Linker`](wasmtime::component::Linker).
7 pub struct TheFlagsPre<T> {
8     instance_pre: wasmtime::component::InstancePre<T>,
9     interface0: exports::foo::foo::flegs::GuestPre,
10 }
11 impl<T> Clone for TheFlagsPre<T> {
12     fn clone(&self) -> Self {
13         Self {
14             instance_pre: self.instance_pre.clone(),
15             interface0: self.interface0.clone(),
16         }
17     }
18 }
19 /// Auto-generated bindings for an instance a component which
20 /// implements the world `the-flags`.
21 ///
22 /// This structure is created through either
23 /// [`TheFlags::instantiate_async`] or by first creating
24 /// a [`TheFlagsPre`] followed by using
25 /// [`TheFlagsPre::instantiate_async`].
26 pub struct TheFlags {
27     interface0: exports::foo::foo::flegs::Guest,
28 }
29 const _: () = {
30     #[allow(unused_imports)]
31     use wasmtime::component::__internal::anyhow;
32     impl<_T> TheFlagsPre<_T> {
33         /// Creates a new copy of `TheFlagsPre` bindings which can then
34         /// be used to instantiate into a particular store.
35         ///
36         /// This method may fail if the component behind `instance_pre`
37         /// does not have the required exports.
38         pub fn new(
39             instance_pre: wasmtime::component::InstancePre<_T>,
40         ) -> wasmtime::Result<Self> {
41             let _component = instance_pre.component();
42             let interface0 = exports::foo::foo::flegs::GuestPre::new(_component)?;
43             Ok(TheFlagsPre {
44                 instance_pre,
45                 interface0,
46             })
47         }
48         /// Instantiates a new instance of [`TheFlags`] within the
49         /// `store` provided.
50         ///
51         /// This function will use `self` as the pre-instantiated
52         /// instance to perform instantiation. Afterwards the preloaded
53         /// indices in `self` are used to lookup all exports on the
54         /// resulting instance.
55         pub async fn instantiate_async(
56             &self,
57             mut store: impl wasmtime::AsContextMut<Data = _T>,
58         ) -> wasmtime::Result<TheFlags>
59         where
60             _T: Send,
61         {
62             let mut store = store.as_context_mut();
63             let _instance = self.instance_pre.instantiate_async(&mut store).await?;
64             let interface0 = self.interface0.load(&mut store, &_instance)?;
65             Ok(TheFlags { interface0 })
66         }
67         pub fn engine(&self) -> &wasmtime::Engine {
68             self.instance_pre.engine()
69         }
70         pub fn instance_pre(&self) -> &wasmtime::component::InstancePre<_T> {
71             &self.instance_pre
72         }
73     }
74     impl TheFlags {
75         /// Convenience wrapper around [`TheFlagsPre::new`] and
76         /// [`TheFlagsPre::instantiate_async`].
77         pub async fn instantiate_async<_T>(
78             mut store: impl wasmtime::AsContextMut<Data = _T>,
79             component: &wasmtime::component::Component,
80             linker: &wasmtime::component::Linker<_T>,
81         ) -> wasmtime::Result<TheFlags>
82         where
83             _T: Send,
84         {
85             let pre = linker.instantiate_pre(component)?;
86             TheFlagsPre::new(pre)?.instantiate_async(store).await
87         }
88         pub fn add_to_linker<T, U>(
89             linker: &mut wasmtime::component::Linker<T>,
90             get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static,
91         ) -> wasmtime::Result<()>
92         where
93             T: Send,
94             U: foo::foo::flegs::Host + Send,
95         {
96             foo::foo::flegs::add_to_linker(linker, get)?;
97             Ok(())
98         }
99         pub fn foo_foo_flegs(&self) -> &exports::foo::foo::flegs::Guest {
100             &self.interface0
101         }
102     }
103 };
104 pub mod foo {
105     pub mod foo {
106         #[allow(clippy::all)]
107         pub mod flegs {
108             #[allow(unused_imports)]
109             use wasmtime::component::__internal::anyhow;
110             wasmtime::component::flags!(Flag1 { #[component(name = "b0")] const B0; });
111             const _: () = {
112                 assert!(1 == < Flag1 as wasmtime::component::ComponentType >::SIZE32);
113                 assert!(1 == < Flag1 as wasmtime::component::ComponentType >::ALIGN32);
114             };
115             wasmtime::component::flags!(
116                 Flag2 { #[component(name = "b0")] const B0; #[component(name = "b1")]
117                 const B1; }
118             );
119             const _: () = {
120                 assert!(1 == < Flag2 as wasmtime::component::ComponentType >::SIZE32);
121                 assert!(1 == < Flag2 as wasmtime::component::ComponentType >::ALIGN32);
122             };
123             wasmtime::component::flags!(
124                 Flag4 { #[component(name = "b0")] const B0; #[component(name = "b1")]
125                 const B1; #[component(name = "b2")] const B2; #[component(name = "b3")]
126                 const B3; }
127             );
128             const _: () = {
129                 assert!(1 == < Flag4 as wasmtime::component::ComponentType >::SIZE32);
130                 assert!(1 == < Flag4 as wasmtime::component::ComponentType >::ALIGN32);
131             };
132             wasmtime::component::flags!(
133                 Flag8 { #[component(name = "b0")] const B0; #[component(name = "b1")]
134                 const B1; #[component(name = "b2")] const B2; #[component(name = "b3")]
135                 const B3; #[component(name = "b4")] const B4; #[component(name = "b5")]
136                 const B5; #[component(name = "b6")] const B6; #[component(name = "b7")]
137                 const B7; }
138             );
139             const _: () = {
140                 assert!(1 == < Flag8 as wasmtime::component::ComponentType >::SIZE32);
141                 assert!(1 == < Flag8 as wasmtime::component::ComponentType >::ALIGN32);
142             };
143             wasmtime::component::flags!(
144                 Flag16 { #[component(name = "b0")] const B0; #[component(name = "b1")]
145                 const B1; #[component(name = "b2")] const B2; #[component(name = "b3")]
146                 const B3; #[component(name = "b4")] const B4; #[component(name = "b5")]
147                 const B5; #[component(name = "b6")] const B6; #[component(name = "b7")]
148                 const B7; #[component(name = "b8")] const B8; #[component(name = "b9")]
149                 const B9; #[component(name = "b10")] const B10; #[component(name =
150                 "b11")] const B11; #[component(name = "b12")] const B12; #[component(name
151                 = "b13")] const B13; #[component(name = "b14")] const B14;
152                 #[component(name = "b15")] const B15; }
153             );
154             const _: () = {
155                 assert!(2 == < Flag16 as wasmtime::component::ComponentType >::SIZE32);
156                 assert!(2 == < Flag16 as wasmtime::component::ComponentType >::ALIGN32);
157             };
158             wasmtime::component::flags!(
159                 Flag32 { #[component(name = "b0")] const B0; #[component(name = "b1")]
160                 const B1; #[component(name = "b2")] const B2; #[component(name = "b3")]
161                 const B3; #[component(name = "b4")] const B4; #[component(name = "b5")]
162                 const B5; #[component(name = "b6")] const B6; #[component(name = "b7")]
163                 const B7; #[component(name = "b8")] const B8; #[component(name = "b9")]
164                 const B9; #[component(name = "b10")] const B10; #[component(name =
165                 "b11")] const B11; #[component(name = "b12")] const B12; #[component(name
166                 = "b13")] const B13; #[component(name = "b14")] const B14;
167                 #[component(name = "b15")] const B15; #[component(name = "b16")] const
168                 B16; #[component(name = "b17")] const B17; #[component(name = "b18")]
169                 const B18; #[component(name = "b19")] const B19; #[component(name =
170                 "b20")] const B20; #[component(name = "b21")] const B21; #[component(name
171                 = "b22")] const B22; #[component(name = "b23")] const B23;
172                 #[component(name = "b24")] const B24; #[component(name = "b25")] const
173                 B25; #[component(name = "b26")] const B26; #[component(name = "b27")]
174                 const B27; #[component(name = "b28")] const B28; #[component(name =
175                 "b29")] const B29; #[component(name = "b30")] const B30; #[component(name
176                 = "b31")] const B31; }
177             );
178             const _: () = {
179                 assert!(4 == < Flag32 as wasmtime::component::ComponentType >::SIZE32);
180                 assert!(4 == < Flag32 as wasmtime::component::ComponentType >::ALIGN32);
181             };
182             wasmtime::component::flags!(
183                 Flag64 { #[component(name = "b0")] const B0; #[component(name = "b1")]
184                 const B1; #[component(name = "b2")] const B2; #[component(name = "b3")]
185                 const B3; #[component(name = "b4")] const B4; #[component(name = "b5")]
186                 const B5; #[component(name = "b6")] const B6; #[component(name = "b7")]
187                 const B7; #[component(name = "b8")] const B8; #[component(name = "b9")]
188                 const B9; #[component(name = "b10")] const B10; #[component(name =
189                 "b11")] const B11; #[component(name = "b12")] const B12; #[component(name
190                 = "b13")] const B13; #[component(name = "b14")] const B14;
191                 #[component(name = "b15")] const B15; #[component(name = "b16")] const
192                 B16; #[component(name = "b17")] const B17; #[component(name = "b18")]
193                 const B18; #[component(name = "b19")] const B19; #[component(name =
194                 "b20")] const B20; #[component(name = "b21")] const B21; #[component(name
195                 = "b22")] const B22; #[component(name = "b23")] const B23;
196                 #[component(name = "b24")] const B24; #[component(name = "b25")] const
197                 B25; #[component(name = "b26")] const B26; #[component(name = "b27")]
198                 const B27; #[component(name = "b28")] const B28; #[component(name =
199                 "b29")] const B29; #[component(name = "b30")] const B30; #[component(name
200                 = "b31")] const B31; #[component(name = "b32")] const B32;
201                 #[component(name = "b33")] const B33; #[component(name = "b34")] const
202                 B34; #[component(name = "b35")] const B35; #[component(name = "b36")]
203                 const B36; #[component(name = "b37")] const B37; #[component(name =
204                 "b38")] const B38; #[component(name = "b39")] const B39; #[component(name
205                 = "b40")] const B40; #[component(name = "b41")] const B41;
206                 #[component(name = "b42")] const B42; #[component(name = "b43")] const
207                 B43; #[component(name = "b44")] const B44; #[component(name = "b45")]
208                 const B45; #[component(name = "b46")] const B46; #[component(name =
209                 "b47")] const B47; #[component(name = "b48")] const B48; #[component(name
210                 = "b49")] const B49; #[component(name = "b50")] const B50;
211                 #[component(name = "b51")] const B51; #[component(name = "b52")] const
212                 B52; #[component(name = "b53")] const B53; #[component(name = "b54")]
213                 const B54; #[component(name = "b55")] const B55; #[component(name =
214                 "b56")] const B56; #[component(name = "b57")] const B57; #[component(name
215                 = "b58")] const B58; #[component(name = "b59")] const B59;
216                 #[component(name = "b60")] const B60; #[component(name = "b61")] const
217                 B61; #[component(name = "b62")] const B62; #[component(name = "b63")]
218                 const B63; }
219             );
220             const _: () = {
221                 assert!(8 == < Flag64 as wasmtime::component::ComponentType >::SIZE32);
222                 assert!(4 == < Flag64 as wasmtime::component::ComponentType >::ALIGN32);
223             };
224             #[wasmtime::component::__internal::async_trait]
225             pub trait Host: Send {
226                 async fn roundtrip_flag1(&mut self, x: Flag1) -> Flag1;
227                 async fn roundtrip_flag2(&mut self, x: Flag2) -> Flag2;
228                 async fn roundtrip_flag4(&mut self, x: Flag4) -> Flag4;
229                 async fn roundtrip_flag8(&mut self, x: Flag8) -> Flag8;
230                 async fn roundtrip_flag16(&mut self, x: Flag16) -> Flag16;
231                 async fn roundtrip_flag32(&mut self, x: Flag32) -> Flag32;
232                 async fn roundtrip_flag64(&mut self, x: Flag64) -> Flag64;
233             }
234             pub trait GetHost<
235                 T,
236             >: Fn(T) -> <Self as GetHost<T>>::Host + Send + Sync + Copy + 'static {
237                 type Host: Host + Send;
238             }
239             impl<F, T, O> GetHost<T> for F
240             where
241                 F: Fn(T) -> O + Send + Sync + Copy + 'static,
242                 O: Host + Send,
243             {
244                 type Host = O;
245             }
246             pub fn add_to_linker_get_host<T>(
247                 linker: &mut wasmtime::component::Linker<T>,
248                 host_getter: impl for<'a> GetHost<&'a mut T>,
249             ) -> wasmtime::Result<()>
250             where
251                 T: Send,
252             {
253                 let mut inst = linker.instance("foo:foo/flegs")?;
254                 inst.func_wrap_async(
255                     "roundtrip-flag1",
256                     move |
257                         mut caller: wasmtime::StoreContextMut<'_, T>,
258                         (arg0,): (Flag1,)|
259                     wasmtime::component::__internal::Box::new(async move {
260                         let host = &mut host_getter(caller.data_mut());
261                         let r = Host::roundtrip_flag1(host, arg0).await;
262                         Ok((r,))
263                     }),
264                 )?;
265                 inst.func_wrap_async(
266                     "roundtrip-flag2",
267                     move |
268                         mut caller: wasmtime::StoreContextMut<'_, T>,
269                         (arg0,): (Flag2,)|
270                     wasmtime::component::__internal::Box::new(async move {
271                         let host = &mut host_getter(caller.data_mut());
272                         let r = Host::roundtrip_flag2(host, arg0).await;
273                         Ok((r,))
274                     }),
275                 )?;
276                 inst.func_wrap_async(
277                     "roundtrip-flag4",
278                     move |
279                         mut caller: wasmtime::StoreContextMut<'_, T>,
280                         (arg0,): (Flag4,)|
281                     wasmtime::component::__internal::Box::new(async move {
282                         let host = &mut host_getter(caller.data_mut());
283                         let r = Host::roundtrip_flag4(host, arg0).await;
284                         Ok((r,))
285                     }),
286                 )?;
287                 inst.func_wrap_async(
288                     "roundtrip-flag8",
289                     move |
290                         mut caller: wasmtime::StoreContextMut<'_, T>,
291                         (arg0,): (Flag8,)|
292                     wasmtime::component::__internal::Box::new(async move {
293                         let host = &mut host_getter(caller.data_mut());
294                         let r = Host::roundtrip_flag8(host, arg0).await;
295                         Ok((r,))
296                     }),
297                 )?;
298                 inst.func_wrap_async(
299                     "roundtrip-flag16",
300                     move |
301                         mut caller: wasmtime::StoreContextMut<'_, T>,
302                         (arg0,): (Flag16,)|
303                     wasmtime::component::__internal::Box::new(async move {
304                         let host = &mut host_getter(caller.data_mut());
305                         let r = Host::roundtrip_flag16(host, arg0).await;
306                         Ok((r,))
307                     }),
308                 )?;
309                 inst.func_wrap_async(
310                     "roundtrip-flag32",
311                     move |
312                         mut caller: wasmtime::StoreContextMut<'_, T>,
313                         (arg0,): (Flag32,)|
314                     wasmtime::component::__internal::Box::new(async move {
315                         let host = &mut host_getter(caller.data_mut());
316                         let r = Host::roundtrip_flag32(host, arg0).await;
317                         Ok((r,))
318                     }),
319                 )?;
320                 inst.func_wrap_async(
321                     "roundtrip-flag64",
322                     move |
323                         mut caller: wasmtime::StoreContextMut<'_, T>,
324                         (arg0,): (Flag64,)|
325                     wasmtime::component::__internal::Box::new(async move {
326                         let host = &mut host_getter(caller.data_mut());
327                         let r = Host::roundtrip_flag64(host, arg0).await;
328                         Ok((r,))
329                     }),
330                 )?;
331                 Ok(())
332             }
333             pub fn add_to_linker<T, U>(
334                 linker: &mut wasmtime::component::Linker<T>,
335                 get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static,
336             ) -> wasmtime::Result<()>
337             where
338                 U: Host + Send,
339                 T: Send,
340             {
341                 add_to_linker_get_host(linker, get)
342             }
343             #[wasmtime::component::__internal::async_trait]
344             impl<_T: Host + ?Sized + Send> Host for &mut _T {
345                 async fn roundtrip_flag1(&mut self, x: Flag1) -> Flag1 {
346                     Host::roundtrip_flag1(*self, x).await
347                 }
348                 async fn roundtrip_flag2(&mut self, x: Flag2) -> Flag2 {
349                     Host::roundtrip_flag2(*self, x).await
350                 }
351                 async fn roundtrip_flag4(&mut self, x: Flag4) -> Flag4 {
352                     Host::roundtrip_flag4(*self, x).await
353                 }
354                 async fn roundtrip_flag8(&mut self, x: Flag8) -> Flag8 {
355                     Host::roundtrip_flag8(*self, x).await
356                 }
357                 async fn roundtrip_flag16(&mut self, x: Flag16) -> Flag16 {
358                     Host::roundtrip_flag16(*self, x).await
359                 }
360                 async fn roundtrip_flag32(&mut self, x: Flag32) -> Flag32 {
361                     Host::roundtrip_flag32(*self, x).await
362                 }
363                 async fn roundtrip_flag64(&mut self, x: Flag64) -> Flag64 {
364                     Host::roundtrip_flag64(*self, x).await
365                 }
366             }
367         }
368     }
369 }
370 pub mod exports {
371     pub mod foo {
372         pub mod foo {
373             #[allow(clippy::all)]
374             pub mod flegs {
375                 #[allow(unused_imports)]
376                 use wasmtime::component::__internal::anyhow;
377                 wasmtime::component::flags!(
378                     Flag1 { #[component(name = "b0")] const B0; }
379                 );
380                 const _: () = {
381                     assert!(
382                         1 == < Flag1 as wasmtime::component::ComponentType >::SIZE32
383                     );
384                     assert!(
385                         1 == < Flag1 as wasmtime::component::ComponentType >::ALIGN32
386                     );
387                 };
388                 wasmtime::component::flags!(
389                     Flag2 { #[component(name = "b0")] const B0; #[component(name = "b1")]
390                     const B1; }
391                 );
392                 const _: () = {
393                     assert!(
394                         1 == < Flag2 as wasmtime::component::ComponentType >::SIZE32
395                     );
396                     assert!(
397                         1 == < Flag2 as wasmtime::component::ComponentType >::ALIGN32
398                     );
399                 };
400                 wasmtime::component::flags!(
401                     Flag4 { #[component(name = "b0")] const B0; #[component(name = "b1")]
402                     const B1; #[component(name = "b2")] const B2; #[component(name =
403                     "b3")] const B3; }
404                 );
405                 const _: () = {
406                     assert!(
407                         1 == < Flag4 as wasmtime::component::ComponentType >::SIZE32
408                     );
409                     assert!(
410                         1 == < Flag4 as wasmtime::component::ComponentType >::ALIGN32
411                     );
412                 };
413                 wasmtime::component::flags!(
414                     Flag8 { #[component(name = "b0")] const B0; #[component(name = "b1")]
415                     const B1; #[component(name = "b2")] const B2; #[component(name =
416                     "b3")] const B3; #[component(name = "b4")] const B4; #[component(name
417                     = "b5")] const B5; #[component(name = "b6")] const B6;
418                     #[component(name = "b7")] const B7; }
419                 );
420                 const _: () = {
421                     assert!(
422                         1 == < Flag8 as wasmtime::component::ComponentType >::SIZE32
423                     );
424                     assert!(
425                         1 == < Flag8 as wasmtime::component::ComponentType >::ALIGN32
426                     );
427                 };
428                 wasmtime::component::flags!(
429                     Flag16 { #[component(name = "b0")] const B0; #[component(name =
430                     "b1")] const B1; #[component(name = "b2")] const B2; #[component(name
431                     = "b3")] const B3; #[component(name = "b4")] const B4;
432                     #[component(name = "b5")] const B5; #[component(name = "b6")] const
433                     B6; #[component(name = "b7")] const B7; #[component(name = "b8")]
434                     const B8; #[component(name = "b9")] const B9; #[component(name =
435                     "b10")] const B10; #[component(name = "b11")] const B11;
436                     #[component(name = "b12")] const B12; #[component(name = "b13")]
437                     const B13; #[component(name = "b14")] const B14; #[component(name =
438                     "b15")] const B15; }
439                 );
440                 const _: () = {
441                     assert!(
442                         2 == < Flag16 as wasmtime::component::ComponentType >::SIZE32
443                     );
444                     assert!(
445                         2 == < Flag16 as wasmtime::component::ComponentType >::ALIGN32
446                     );
447                 };
448                 wasmtime::component::flags!(
449                     Flag32 { #[component(name = "b0")] const B0; #[component(name =
450                     "b1")] const B1; #[component(name = "b2")] const B2; #[component(name
451                     = "b3")] const B3; #[component(name = "b4")] const B4;
452                     #[component(name = "b5")] const B5; #[component(name = "b6")] const
453                     B6; #[component(name = "b7")] const B7; #[component(name = "b8")]
454                     const B8; #[component(name = "b9")] const B9; #[component(name =
455                     "b10")] const B10; #[component(name = "b11")] const B11;
456                     #[component(name = "b12")] const B12; #[component(name = "b13")]
457                     const B13; #[component(name = "b14")] const B14; #[component(name =
458                     "b15")] const B15; #[component(name = "b16")] const B16;
459                     #[component(name = "b17")] const B17; #[component(name = "b18")]
460                     const B18; #[component(name = "b19")] const B19; #[component(name =
461                     "b20")] const B20; #[component(name = "b21")] const B21;
462                     #[component(name = "b22")] const B22; #[component(name = "b23")]
463                     const B23; #[component(name = "b24")] const B24; #[component(name =
464                     "b25")] const B25; #[component(name = "b26")] const B26;
465                     #[component(name = "b27")] const B27; #[component(name = "b28")]
466                     const B28; #[component(name = "b29")] const B29; #[component(name =
467                     "b30")] const B30; #[component(name = "b31")] const B31; }
468                 );
469                 const _: () = {
470                     assert!(
471                         4 == < Flag32 as wasmtime::component::ComponentType >::SIZE32
472                     );
473                     assert!(
474                         4 == < Flag32 as wasmtime::component::ComponentType >::ALIGN32
475                     );
476                 };
477                 wasmtime::component::flags!(
478                     Flag64 { #[component(name = "b0")] const B0; #[component(name =
479                     "b1")] const B1; #[component(name = "b2")] const B2; #[component(name
480                     = "b3")] const B3; #[component(name = "b4")] const B4;
481                     #[component(name = "b5")] const B5; #[component(name = "b6")] const
482                     B6; #[component(name = "b7")] const B7; #[component(name = "b8")]
483                     const B8; #[component(name = "b9")] const B9; #[component(name =
484                     "b10")] const B10; #[component(name = "b11")] const B11;
485                     #[component(name = "b12")] const B12; #[component(name = "b13")]
486                     const B13; #[component(name = "b14")] const B14; #[component(name =
487                     "b15")] const B15; #[component(name = "b16")] const B16;
488                     #[component(name = "b17")] const B17; #[component(name = "b18")]
489                     const B18; #[component(name = "b19")] const B19; #[component(name =
490                     "b20")] const B20; #[component(name = "b21")] const B21;
491                     #[component(name = "b22")] const B22; #[component(name = "b23")]
492                     const B23; #[component(name = "b24")] const B24; #[component(name =
493                     "b25")] const B25; #[component(name = "b26")] const B26;
494                     #[component(name = "b27")] const B27; #[component(name = "b28")]
495                     const B28; #[component(name = "b29")] const B29; #[component(name =
496                     "b30")] const B30; #[component(name = "b31")] const B31;
497                     #[component(name = "b32")] const B32; #[component(name = "b33")]
498                     const B33; #[component(name = "b34")] const B34; #[component(name =
499                     "b35")] const B35; #[component(name = "b36")] const B36;
500                     #[component(name = "b37")] const B37; #[component(name = "b38")]
501                     const B38; #[component(name = "b39")] const B39; #[component(name =
502                     "b40")] const B40; #[component(name = "b41")] const B41;
503                     #[component(name = "b42")] const B42; #[component(name = "b43")]
504                     const B43; #[component(name = "b44")] const B44; #[component(name =
505                     "b45")] const B45; #[component(name = "b46")] const B46;
506                     #[component(name = "b47")] const B47; #[component(name = "b48")]
507                     const B48; #[component(name = "b49")] const B49; #[component(name =
508                     "b50")] const B50; #[component(name = "b51")] const B51;
509                     #[component(name = "b52")] const B52; #[component(name = "b53")]
510                     const B53; #[component(name = "b54")] const B54; #[component(name =
511                     "b55")] const B55; #[component(name = "b56")] const B56;
512                     #[component(name = "b57")] const B57; #[component(name = "b58")]
513                     const B58; #[component(name = "b59")] const B59; #[component(name =
514                     "b60")] const B60; #[component(name = "b61")] const B61;
515                     #[component(name = "b62")] const B62; #[component(name = "b63")]
516                     const B63; }
517                 );
518                 const _: () = {
519                     assert!(
520                         8 == < Flag64 as wasmtime::component::ComponentType >::SIZE32
521                     );
522                     assert!(
523                         4 == < Flag64 as wasmtime::component::ComponentType >::ALIGN32
524                     );
525                 };
526                 pub struct Guest {
527                     roundtrip_flag1: wasmtime::component::Func,
528                     roundtrip_flag2: wasmtime::component::Func,
529                     roundtrip_flag4: wasmtime::component::Func,
530                     roundtrip_flag8: wasmtime::component::Func,
531                     roundtrip_flag16: wasmtime::component::Func,
532                     roundtrip_flag32: wasmtime::component::Func,
533                     roundtrip_flag64: wasmtime::component::Func,
534                 }
535                 #[derive(Clone)]
536                 pub struct GuestPre {
537                     roundtrip_flag1: wasmtime::component::ComponentExportIndex,
538                     roundtrip_flag2: wasmtime::component::ComponentExportIndex,
539                     roundtrip_flag4: wasmtime::component::ComponentExportIndex,
540                     roundtrip_flag8: wasmtime::component::ComponentExportIndex,
541                     roundtrip_flag16: wasmtime::component::ComponentExportIndex,
542                     roundtrip_flag32: wasmtime::component::ComponentExportIndex,
543                     roundtrip_flag64: wasmtime::component::ComponentExportIndex,
544                 }
545                 impl GuestPre {
546                     pub fn new(
547                         component: &wasmtime::component::Component,
548                     ) -> wasmtime::Result<GuestPre> {
549                         let _component = component;
550                         let (_, instance) = component
551                             .export_index(None, "foo:foo/flegs")
552                             .ok_or_else(|| {
553                                 anyhow::anyhow!(
554                                     "no exported instance named `foo:foo/flegs`"
555                                 )
556                             })?;
557                         let _lookup = |name: &str| {
558                             _component
559                                 .export_index(Some(&instance), name)
560                                 .map(|p| p.1)
561                                 .ok_or_else(|| {
562                                     anyhow::anyhow!(
563                                         "instance export `foo:foo/flegs` does \
564                 not have export `{name}`"
565                                     )
566                                 })
567                         };
568                         let roundtrip_flag1 = _lookup("roundtrip-flag1")?;
569                         let roundtrip_flag2 = _lookup("roundtrip-flag2")?;
570                         let roundtrip_flag4 = _lookup("roundtrip-flag4")?;
571                         let roundtrip_flag8 = _lookup("roundtrip-flag8")?;
572                         let roundtrip_flag16 = _lookup("roundtrip-flag16")?;
573                         let roundtrip_flag32 = _lookup("roundtrip-flag32")?;
574                         let roundtrip_flag64 = _lookup("roundtrip-flag64")?;
575                         Ok(GuestPre {
576                             roundtrip_flag1,
577                             roundtrip_flag2,
578                             roundtrip_flag4,
579                             roundtrip_flag8,
580                             roundtrip_flag16,
581                             roundtrip_flag32,
582                             roundtrip_flag64,
583                         })
584                     }
585                     pub fn load(
586                         &self,
587                         mut store: impl wasmtime::AsContextMut,
588                         instance: &wasmtime::component::Instance,
589                     ) -> wasmtime::Result<Guest> {
590                         let mut store = store.as_context_mut();
591                         let _ = &mut store;
592                         let _instance = instance;
593                         let roundtrip_flag1 = *_instance
594                             .get_typed_func::<
595                                 (Flag1,),
596                                 (Flag1,),
597                             >(&mut store, &self.roundtrip_flag1)?
598                             .func();
599                         let roundtrip_flag2 = *_instance
600                             .get_typed_func::<
601                                 (Flag2,),
602                                 (Flag2,),
603                             >(&mut store, &self.roundtrip_flag2)?
604                             .func();
605                         let roundtrip_flag4 = *_instance
606                             .get_typed_func::<
607                                 (Flag4,),
608                                 (Flag4,),
609                             >(&mut store, &self.roundtrip_flag4)?
610                             .func();
611                         let roundtrip_flag8 = *_instance
612                             .get_typed_func::<
613                                 (Flag8,),
614                                 (Flag8,),
615                             >(&mut store, &self.roundtrip_flag8)?
616                             .func();
617                         let roundtrip_flag16 = *_instance
618                             .get_typed_func::<
619                                 (Flag16,),
620                                 (Flag16,),
621                             >(&mut store, &self.roundtrip_flag16)?
622                             .func();
623                         let roundtrip_flag32 = *_instance
624                             .get_typed_func::<
625                                 (Flag32,),
626                                 (Flag32,),
627                             >(&mut store, &self.roundtrip_flag32)?
628                             .func();
629                         let roundtrip_flag64 = *_instance
630                             .get_typed_func::<
631                                 (Flag64,),
632                                 (Flag64,),
633                             >(&mut store, &self.roundtrip_flag64)?
634                             .func();
635                         Ok(Guest {
636                             roundtrip_flag1,
637                             roundtrip_flag2,
638                             roundtrip_flag4,
639                             roundtrip_flag8,
640                             roundtrip_flag16,
641                             roundtrip_flag32,
642                             roundtrip_flag64,
643                         })
644                     }
645                 }
646                 impl Guest {
647                     pub async fn call_roundtrip_flag1<S: wasmtime::AsContextMut>(
648                         &self,
649                         mut store: S,
650                         arg0: Flag1,
651                     ) -> wasmtime::Result<Flag1>
652                     where
653                         <S as wasmtime::AsContext>::Data: Send,
654                     {
655                         let callee = unsafe {
656                             wasmtime::component::TypedFunc::<
657                                 (Flag1,),
658                                 (Flag1,),
659                             >::new_unchecked(self.roundtrip_flag1)
660                         };
661                         let (ret0,) = callee
662                             .call_async(store.as_context_mut(), (arg0,))
663                             .await?;
664                         callee.post_return_async(store.as_context_mut()).await?;
665                         Ok(ret0)
666                     }
667                     pub async fn call_roundtrip_flag2<S: wasmtime::AsContextMut>(
668                         &self,
669                         mut store: S,
670                         arg0: Flag2,
671                     ) -> wasmtime::Result<Flag2>
672                     where
673                         <S as wasmtime::AsContext>::Data: Send,
674                     {
675                         let callee = unsafe {
676                             wasmtime::component::TypedFunc::<
677                                 (Flag2,),
678                                 (Flag2,),
679                             >::new_unchecked(self.roundtrip_flag2)
680                         };
681                         let (ret0,) = callee
682                             .call_async(store.as_context_mut(), (arg0,))
683                             .await?;
684                         callee.post_return_async(store.as_context_mut()).await?;
685                         Ok(ret0)
686                     }
687                     pub async fn call_roundtrip_flag4<S: wasmtime::AsContextMut>(
688                         &self,
689                         mut store: S,
690                         arg0: Flag4,
691                     ) -> wasmtime::Result<Flag4>
692                     where
693                         <S as wasmtime::AsContext>::Data: Send,
694                     {
695                         let callee = unsafe {
696                             wasmtime::component::TypedFunc::<
697                                 (Flag4,),
698                                 (Flag4,),
699                             >::new_unchecked(self.roundtrip_flag4)
700                         };
701                         let (ret0,) = callee
702                             .call_async(store.as_context_mut(), (arg0,))
703                             .await?;
704                         callee.post_return_async(store.as_context_mut()).await?;
705                         Ok(ret0)
706                     }
707                     pub async fn call_roundtrip_flag8<S: wasmtime::AsContextMut>(
708                         &self,
709                         mut store: S,
710                         arg0: Flag8,
711                     ) -> wasmtime::Result<Flag8>
712                     where
713                         <S as wasmtime::AsContext>::Data: Send,
714                     {
715                         let callee = unsafe {
716                             wasmtime::component::TypedFunc::<
717                                 (Flag8,),
718                                 (Flag8,),
719                             >::new_unchecked(self.roundtrip_flag8)
720                         };
721                         let (ret0,) = callee
722                             .call_async(store.as_context_mut(), (arg0,))
723                             .await?;
724                         callee.post_return_async(store.as_context_mut()).await?;
725                         Ok(ret0)
726                     }
727                     pub async fn call_roundtrip_flag16<S: wasmtime::AsContextMut>(
728                         &self,
729                         mut store: S,
730                         arg0: Flag16,
731                     ) -> wasmtime::Result<Flag16>
732                     where
733                         <S as wasmtime::AsContext>::Data: Send,
734                     {
735                         let callee = unsafe {
736                             wasmtime::component::TypedFunc::<
737                                 (Flag16,),
738                                 (Flag16,),
739                             >::new_unchecked(self.roundtrip_flag16)
740                         };
741                         let (ret0,) = callee
742                             .call_async(store.as_context_mut(), (arg0,))
743                             .await?;
744                         callee.post_return_async(store.as_context_mut()).await?;
745                         Ok(ret0)
746                     }
747                     pub async fn call_roundtrip_flag32<S: wasmtime::AsContextMut>(
748                         &self,
749                         mut store: S,
750                         arg0: Flag32,
751                     ) -> wasmtime::Result<Flag32>
752                     where
753                         <S as wasmtime::AsContext>::Data: Send,
754                     {
755                         let callee = unsafe {
756                             wasmtime::component::TypedFunc::<
757                                 (Flag32,),
758                                 (Flag32,),
759                             >::new_unchecked(self.roundtrip_flag32)
760                         };
761                         let (ret0,) = callee
762                             .call_async(store.as_context_mut(), (arg0,))
763                             .await?;
764                         callee.post_return_async(store.as_context_mut()).await?;
765                         Ok(ret0)
766                     }
767                     pub async fn call_roundtrip_flag64<S: wasmtime::AsContextMut>(
768                         &self,
769                         mut store: S,
770                         arg0: Flag64,
771                     ) -> wasmtime::Result<Flag64>
772                     where
773                         <S as wasmtime::AsContext>::Data: Send,
774                     {
775                         let callee = unsafe {
776                             wasmtime::component::TypedFunc::<
777                                 (Flag64,),
778                                 (Flag64,),
779                             >::new_unchecked(self.roundtrip_flag64)
780                         };
781                         let (ret0,) = callee
782                             .call_async(store.as_context_mut(), (arg0,))
783                             .await?;
784                         callee.post_return_async(store.as_context_mut()).await?;
785                         Ok(ret0)
786                     }
787                 }
788             }
789         }
790     }
791 }
792