1 /// Auto-generated bindings for a pre-instantiated version of a
2 /// component which implements the world `my-world`.
3 ///
4 /// This structure is created through [`MyWorldPre::new`] which
5 /// takes a [`InstancePre`](wasmtime::component::InstancePre) that
6 /// has been created through a [`Linker`](wasmtime::component::Linker).
7 ///
8 /// For more information see [`MyWorld`] as well.
9 pub struct MyWorldPre<T: 'static> {
10     instance_pre: wasmtime::component::InstancePre<T>,
11     indices: MyWorldIndices,
12 }
13 impl<T: 'static> Clone for MyWorldPre<T> {
clone(&self) -> Self14     fn clone(&self) -> Self {
15         Self {
16             instance_pre: self.instance_pre.clone(),
17             indices: self.indices.clone(),
18         }
19     }
20 }
21 impl<_T: 'static> MyWorldPre<_T> {
22     /// Creates a new copy of `MyWorldPre` bindings which can then
23     /// be used to instantiate into a particular store.
24     ///
25     /// This method may fail if the component behind `instance_pre`
26     /// does not have the required exports.
new( instance_pre: wasmtime::component::InstancePre<_T>, ) -> wasmtime::Result<Self>27     pub fn new(
28         instance_pre: wasmtime::component::InstancePre<_T>,
29     ) -> wasmtime::Result<Self> {
30         let indices = MyWorldIndices::new(&instance_pre)?;
31         Ok(Self { instance_pre, indices })
32     }
engine(&self) -> &wasmtime::Engine33     pub fn engine(&self) -> &wasmtime::Engine {
34         self.instance_pre.engine()
35     }
instance_pre(&self) -> &wasmtime::component::InstancePre<_T>36     pub fn instance_pre(&self) -> &wasmtime::component::InstancePre<_T> {
37         &self.instance_pre
38     }
39     /// Instantiates a new instance of [`MyWorld`] within the
40     /// `store` provided.
41     ///
42     /// This function will use `self` as the pre-instantiated
43     /// instance to perform instantiation. Afterwards the preloaded
44     /// indices in `self` are used to lookup all exports on the
45     /// resulting instance.
instantiate( &self, mut store: impl wasmtime::AsContextMut<Data = _T>, ) -> wasmtime::Result<MyWorld>46     pub fn instantiate(
47         &self,
48         mut store: impl wasmtime::AsContextMut<Data = _T>,
49     ) -> wasmtime::Result<MyWorld> {
50         let mut store = store.as_context_mut();
51         let instance = self.instance_pre.instantiate(&mut store)?;
52         self.indices.load(&mut store, &instance)
53     }
54 }
55 impl<_T: Send + 'static> MyWorldPre<_T> {
56     /// Same as [`Self::instantiate`], except with `async`.
instantiate_async( &self, mut store: impl wasmtime::AsContextMut<Data = _T>, ) -> wasmtime::Result<MyWorld>57     pub async fn instantiate_async(
58         &self,
59         mut store: impl wasmtime::AsContextMut<Data = _T>,
60     ) -> wasmtime::Result<MyWorld> {
61         let mut store = store.as_context_mut();
62         let instance = self.instance_pre.instantiate_async(&mut store).await?;
63         self.indices.load(&mut store, &instance)
64     }
65 }
66 /// Auto-generated bindings for index of the exports of
67 /// `my-world`.
68 ///
69 /// This is an implementation detail of [`MyWorldPre`] and can
70 /// be constructed if needed as well.
71 ///
72 /// For more information see [`MyWorld`] as well.
73 #[derive(Clone)]
74 pub struct MyWorldIndices {
75     interface0: exports::foo::foo::variants::GuestIndices,
76 }
77 /// Auto-generated bindings for an instance a component which
78 /// implements the world `my-world`.
79 ///
80 /// This structure can be created through a number of means
81 /// depending on your requirements and what you have on hand:
82 ///
83 /// * The most convenient way is to use
84 ///   [`MyWorld::instantiate`] which only needs a
85 ///   [`Store`], [`Component`], and [`Linker`].
86 ///
87 /// * Alternatively you can create a [`MyWorldPre`] ahead of
88 ///   time with a [`Component`] to front-load string lookups
89 ///   of exports once instead of per-instantiation. This
90 ///   method then uses [`MyWorldPre::instantiate`] to
91 ///   create a [`MyWorld`].
92 ///
93 /// * If you've instantiated the instance yourself already
94 ///   then you can use [`MyWorld::new`].
95 ///
96 /// These methods are all equivalent to one another and move
97 /// around the tradeoff of what work is performed when.
98 ///
99 /// [`Store`]: wasmtime::Store
100 /// [`Component`]: wasmtime::component::Component
101 /// [`Linker`]: wasmtime::component::Linker
102 pub struct MyWorld {
103     interface0: exports::foo::foo::variants::Guest,
104 }
105 const _: () = {
106     impl MyWorldIndices {
107         /// Creates a new copy of `MyWorldIndices` bindings which can then
108         /// be used to instantiate into a particular store.
109         ///
110         /// This method may fail if the component does not have the
111         /// required exports.
new<_T>( _instance_pre: &wasmtime::component::InstancePre<_T>, ) -> wasmtime::Result<Self>112         pub fn new<_T>(
113             _instance_pre: &wasmtime::component::InstancePre<_T>,
114         ) -> wasmtime::Result<Self> {
115             let _component = _instance_pre.component();
116             let _instance_type = _instance_pre.instance_type();
117             let interface0 = exports::foo::foo::variants::GuestIndices::new(
118                 _instance_pre,
119             )?;
120             Ok(MyWorldIndices { interface0 })
121         }
122         /// Uses the indices stored in `self` to load an instance
123         /// of [`MyWorld`] from the instance provided.
124         ///
125         /// Note that at this time this method will additionally
126         /// perform type-checks of all exports.
load( &self, mut store: impl wasmtime::AsContextMut, instance: &wasmtime::component::Instance, ) -> wasmtime::Result<MyWorld>127         pub fn load(
128             &self,
129             mut store: impl wasmtime::AsContextMut,
130             instance: &wasmtime::component::Instance,
131         ) -> wasmtime::Result<MyWorld> {
132             let _ = &mut store;
133             let _instance = instance;
134             let interface0 = self.interface0.load(&mut store, &_instance)?;
135             Ok(MyWorld { interface0 })
136         }
137     }
138     impl MyWorld {
139         /// Convenience wrapper around [`MyWorldPre::new`] and
140         /// [`MyWorldPre::instantiate`].
instantiate<_T>( store: impl wasmtime::AsContextMut<Data = _T>, component: &wasmtime::component::Component, linker: &wasmtime::component::Linker<_T>, ) -> wasmtime::Result<MyWorld>141         pub fn instantiate<_T>(
142             store: impl wasmtime::AsContextMut<Data = _T>,
143             component: &wasmtime::component::Component,
144             linker: &wasmtime::component::Linker<_T>,
145         ) -> wasmtime::Result<MyWorld> {
146             let pre = linker.instantiate_pre(component)?;
147             MyWorldPre::new(pre)?.instantiate(store)
148         }
149         /// Convenience wrapper around [`MyWorldIndices::new`] and
150         /// [`MyWorldIndices::load`].
new( mut store: impl wasmtime::AsContextMut, instance: &wasmtime::component::Instance, ) -> wasmtime::Result<MyWorld>151         pub fn new(
152             mut store: impl wasmtime::AsContextMut,
153             instance: &wasmtime::component::Instance,
154         ) -> wasmtime::Result<MyWorld> {
155             let indices = MyWorldIndices::new(&instance.instance_pre(&store))?;
156             indices.load(&mut store, instance)
157         }
158         /// Convenience wrapper around [`MyWorldPre::new`] and
159         /// [`MyWorldPre::instantiate_async`].
instantiate_async<_T>( store: impl wasmtime::AsContextMut<Data = _T>, component: &wasmtime::component::Component, linker: &wasmtime::component::Linker<_T>, ) -> wasmtime::Result<MyWorld> where _T: Send,160         pub async fn instantiate_async<_T>(
161             store: impl wasmtime::AsContextMut<Data = _T>,
162             component: &wasmtime::component::Component,
163             linker: &wasmtime::component::Linker<_T>,
164         ) -> wasmtime::Result<MyWorld>
165         where
166             _T: Send,
167         {
168             let pre = linker.instantiate_pre(component)?;
169             MyWorldPre::new(pre)?.instantiate_async(store).await
170         }
add_to_linker<T, D>( linker: &mut wasmtime::component::Linker<T>, host_getter: fn(&mut T) -> D::Data<'_>, ) -> wasmtime::Result<()> where D: foo::foo::variants::HostWithStore + Send, for<'a> D::Data<'a>: foo::foo::variants::Host + Send, T: 'static + Send,171         pub fn add_to_linker<T, D>(
172             linker: &mut wasmtime::component::Linker<T>,
173             host_getter: fn(&mut T) -> D::Data<'_>,
174         ) -> wasmtime::Result<()>
175         where
176             D: foo::foo::variants::HostWithStore + Send,
177             for<'a> D::Data<'a>: foo::foo::variants::Host + Send,
178             T: 'static + Send,
179         {
180             foo::foo::variants::add_to_linker::<T, D>(linker, host_getter)?;
181             Ok(())
182         }
foo_foo_variants(&self) -> &exports::foo::foo::variants::Guest183         pub fn foo_foo_variants(&self) -> &exports::foo::foo::variants::Guest {
184             &self.interface0
185         }
186     }
187 };
188 pub mod foo {
189     pub mod foo {
190         #[allow(clippy::all)]
191         pub mod variants {
192             #[allow(unused_imports)]
193             use wasmtime::component::__internal::Box;
194             #[derive(wasmtime::component::ComponentType)]
195             #[derive(wasmtime::component::Lift)]
196             #[derive(wasmtime::component::Lower)]
197             #[component(enum)]
198             #[derive(Clone, Copy, Eq, PartialEq)]
199             #[repr(u8)]
200             pub enum E1 {
201                 #[component(name = "a")]
202                 A,
203             }
204             impl core::fmt::Debug for E1 {
fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result205                 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
206                     match self {
207                         E1::A => f.debug_tuple("E1::A").finish(),
208                     }
209                 }
210             }
211             const _: () = {
212                 assert!(1 == < E1 as wasmtime::component::ComponentType >::SIZE32);
213                 assert!(1 == < E1 as wasmtime::component::ComponentType >::ALIGN32);
214             };
215             #[derive(wasmtime::component::ComponentType)]
216             #[derive(wasmtime::component::Lift)]
217             #[derive(wasmtime::component::Lower)]
218             #[component(record)]
219             #[derive(Clone, Copy)]
220             pub struct Empty {}
221             impl core::fmt::Debug for Empty {
fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result222                 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
223                     f.debug_struct("Empty").finish()
224                 }
225             }
226             const _: () = {
227                 assert!(0 == < Empty as wasmtime::component::ComponentType >::SIZE32);
228                 assert!(1 == < Empty as wasmtime::component::ComponentType >::ALIGN32);
229             };
230             #[derive(wasmtime::component::ComponentType)]
231             #[derive(wasmtime::component::Lift)]
232             #[derive(wasmtime::component::Lower)]
233             #[component(variant)]
234             #[derive(Clone)]
235             pub enum V1 {
236                 #[component(name = "a")]
237                 A,
238                 #[component(name = "c")]
239                 C(E1),
240                 #[component(name = "d")]
241                 D(wasmtime::component::__internal::String),
242                 #[component(name = "e")]
243                 E(Empty),
244                 #[component(name = "f")]
245                 F,
246                 #[component(name = "g")]
247                 G(u32),
248             }
249             impl core::fmt::Debug for V1 {
fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result250                 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
251                     match self {
252                         V1::A => f.debug_tuple("V1::A").finish(),
253                         V1::C(e) => f.debug_tuple("V1::C").field(e).finish(),
254                         V1::D(e) => f.debug_tuple("V1::D").field(e).finish(),
255                         V1::E(e) => f.debug_tuple("V1::E").field(e).finish(),
256                         V1::F => f.debug_tuple("V1::F").finish(),
257                         V1::G(e) => f.debug_tuple("V1::G").field(e).finish(),
258                     }
259                 }
260             }
261             const _: () = {
262                 assert!(12 == < V1 as wasmtime::component::ComponentType >::SIZE32);
263                 assert!(4 == < V1 as wasmtime::component::ComponentType >::ALIGN32);
264             };
265             #[derive(wasmtime::component::ComponentType)]
266             #[derive(wasmtime::component::Lift)]
267             #[derive(wasmtime::component::Lower)]
268             #[component(variant)]
269             #[derive(Clone, Copy)]
270             pub enum Casts1 {
271                 #[component(name = "a")]
272                 A(i32),
273                 #[component(name = "b")]
274                 B(f32),
275             }
276             impl core::fmt::Debug for Casts1 {
fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result277                 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
278                     match self {
279                         Casts1::A(e) => f.debug_tuple("Casts1::A").field(e).finish(),
280                         Casts1::B(e) => f.debug_tuple("Casts1::B").field(e).finish(),
281                     }
282                 }
283             }
284             const _: () = {
285                 assert!(8 == < Casts1 as wasmtime::component::ComponentType >::SIZE32);
286                 assert!(4 == < Casts1 as wasmtime::component::ComponentType >::ALIGN32);
287             };
288             #[derive(wasmtime::component::ComponentType)]
289             #[derive(wasmtime::component::Lift)]
290             #[derive(wasmtime::component::Lower)]
291             #[component(variant)]
292             #[derive(Clone, Copy)]
293             pub enum Casts2 {
294                 #[component(name = "a")]
295                 A(f64),
296                 #[component(name = "b")]
297                 B(f32),
298             }
299             impl core::fmt::Debug for Casts2 {
fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result300                 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
301                     match self {
302                         Casts2::A(e) => f.debug_tuple("Casts2::A").field(e).finish(),
303                         Casts2::B(e) => f.debug_tuple("Casts2::B").field(e).finish(),
304                     }
305                 }
306             }
307             const _: () = {
308                 assert!(16 == < Casts2 as wasmtime::component::ComponentType >::SIZE32);
309                 assert!(8 == < Casts2 as wasmtime::component::ComponentType >::ALIGN32);
310             };
311             #[derive(wasmtime::component::ComponentType)]
312             #[derive(wasmtime::component::Lift)]
313             #[derive(wasmtime::component::Lower)]
314             #[component(variant)]
315             #[derive(Clone, Copy)]
316             pub enum Casts3 {
317                 #[component(name = "a")]
318                 A(f64),
319                 #[component(name = "b")]
320                 B(u64),
321             }
322             impl core::fmt::Debug for Casts3 {
fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result323                 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
324                     match self {
325                         Casts3::A(e) => f.debug_tuple("Casts3::A").field(e).finish(),
326                         Casts3::B(e) => f.debug_tuple("Casts3::B").field(e).finish(),
327                     }
328                 }
329             }
330             const _: () = {
331                 assert!(16 == < Casts3 as wasmtime::component::ComponentType >::SIZE32);
332                 assert!(8 == < Casts3 as wasmtime::component::ComponentType >::ALIGN32);
333             };
334             #[derive(wasmtime::component::ComponentType)]
335             #[derive(wasmtime::component::Lift)]
336             #[derive(wasmtime::component::Lower)]
337             #[component(variant)]
338             #[derive(Clone, Copy)]
339             pub enum Casts4 {
340                 #[component(name = "a")]
341                 A(u32),
342                 #[component(name = "b")]
343                 B(i64),
344             }
345             impl core::fmt::Debug for Casts4 {
fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result346                 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
347                     match self {
348                         Casts4::A(e) => f.debug_tuple("Casts4::A").field(e).finish(),
349                         Casts4::B(e) => f.debug_tuple("Casts4::B").field(e).finish(),
350                     }
351                 }
352             }
353             const _: () = {
354                 assert!(16 == < Casts4 as wasmtime::component::ComponentType >::SIZE32);
355                 assert!(8 == < Casts4 as wasmtime::component::ComponentType >::ALIGN32);
356             };
357             #[derive(wasmtime::component::ComponentType)]
358             #[derive(wasmtime::component::Lift)]
359             #[derive(wasmtime::component::Lower)]
360             #[component(variant)]
361             #[derive(Clone, Copy)]
362             pub enum Casts5 {
363                 #[component(name = "a")]
364                 A(f32),
365                 #[component(name = "b")]
366                 B(i64),
367             }
368             impl core::fmt::Debug for Casts5 {
fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result369                 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
370                     match self {
371                         Casts5::A(e) => f.debug_tuple("Casts5::A").field(e).finish(),
372                         Casts5::B(e) => f.debug_tuple("Casts5::B").field(e).finish(),
373                     }
374                 }
375             }
376             const _: () = {
377                 assert!(16 == < Casts5 as wasmtime::component::ComponentType >::SIZE32);
378                 assert!(8 == < Casts5 as wasmtime::component::ComponentType >::ALIGN32);
379             };
380             #[derive(wasmtime::component::ComponentType)]
381             #[derive(wasmtime::component::Lift)]
382             #[derive(wasmtime::component::Lower)]
383             #[component(variant)]
384             #[derive(Clone, Copy)]
385             pub enum Casts6 {
386                 #[component(name = "a")]
387                 A((f32, u32)),
388                 #[component(name = "b")]
389                 B((u32, u32)),
390             }
391             impl core::fmt::Debug for Casts6 {
fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result392                 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
393                     match self {
394                         Casts6::A(e) => f.debug_tuple("Casts6::A").field(e).finish(),
395                         Casts6::B(e) => f.debug_tuple("Casts6::B").field(e).finish(),
396                     }
397                 }
398             }
399             const _: () = {
400                 assert!(12 == < Casts6 as wasmtime::component::ComponentType >::SIZE32);
401                 assert!(4 == < Casts6 as wasmtime::component::ComponentType >::ALIGN32);
402             };
403             #[derive(wasmtime::component::ComponentType)]
404             #[derive(wasmtime::component::Lift)]
405             #[derive(wasmtime::component::Lower)]
406             #[component(enum)]
407             #[derive(Clone, Copy, Eq, PartialEq)]
408             #[repr(u8)]
409             pub enum MyErrno {
410                 #[component(name = "bad1")]
411                 Bad1,
412                 #[component(name = "bad2")]
413                 Bad2,
414             }
415             impl MyErrno {
name(&self) -> &'static str416                 pub fn name(&self) -> &'static str {
417                     match self {
418                         MyErrno::Bad1 => "bad1",
419                         MyErrno::Bad2 => "bad2",
420                     }
421                 }
message(&self) -> &'static str422                 pub fn message(&self) -> &'static str {
423                     match self {
424                         MyErrno::Bad1 => "",
425                         MyErrno::Bad2 => "",
426                     }
427                 }
428             }
429             impl core::fmt::Debug for MyErrno {
fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result430                 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
431                     f.debug_struct("MyErrno")
432                         .field("code", &(*self as i32))
433                         .field("name", &self.name())
434                         .field("message", &self.message())
435                         .finish()
436                 }
437             }
438             impl core::fmt::Display for MyErrno {
fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result439                 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
440                     write!(f, "{} (error {})", self.name(), * self as i32)
441                 }
442             }
443             impl core::error::Error for MyErrno {}
444             const _: () = {
445                 assert!(1 == < MyErrno as wasmtime::component::ComponentType >::SIZE32);
446                 assert!(1 == < MyErrno as wasmtime::component::ComponentType >::ALIGN32);
447             };
448             #[derive(wasmtime::component::ComponentType)]
449             #[derive(wasmtime::component::Lift)]
450             #[derive(wasmtime::component::Lower)]
451             #[component(record)]
452             #[derive(Clone)]
453             pub struct IsClone {
454                 #[component(name = "v1")]
455                 pub v1: V1,
456             }
457             impl core::fmt::Debug for IsClone {
fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result458                 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
459                     f.debug_struct("IsClone").field("v1", &self.v1).finish()
460                 }
461             }
462             const _: () = {
463                 assert!(12 == < IsClone as wasmtime::component::ComponentType >::SIZE32);
464                 assert!(4 == < IsClone as wasmtime::component::ComponentType >::ALIGN32);
465             };
466             pub trait HostWithStore: wasmtime::component::HasData + Send {}
467             impl<_T: ?Sized> HostWithStore for _T
468             where
469                 _T: wasmtime::component::HasData + Send,
470             {}
471             pub trait Host: Send {
e1_arg( &mut self, x: E1, ) -> impl ::core::future::Future<Output = ()> + Send472                 fn e1_arg(
473                     &mut self,
474                     x: E1,
475                 ) -> impl ::core::future::Future<Output = ()> + Send;
e1_result( &mut self, ) -> impl ::core::future::Future<Output = E1> + Send476                 fn e1_result(
477                     &mut self,
478                 ) -> impl ::core::future::Future<Output = E1> + Send;
v1_arg( &mut self, x: V1, ) -> impl ::core::future::Future<Output = ()> + Send479                 fn v1_arg(
480                     &mut self,
481                     x: V1,
482                 ) -> impl ::core::future::Future<Output = ()> + Send;
v1_result( &mut self, ) -> impl ::core::future::Future<Output = V1> + Send483                 fn v1_result(
484                     &mut self,
485                 ) -> impl ::core::future::Future<Output = V1> + Send;
bool_arg( &mut self, x: bool, ) -> impl ::core::future::Future<Output = ()> + Send486                 fn bool_arg(
487                     &mut self,
488                     x: bool,
489                 ) -> impl ::core::future::Future<Output = ()> + Send;
bool_result( &mut self, ) -> impl ::core::future::Future<Output = bool> + Send490                 fn bool_result(
491                     &mut self,
492                 ) -> impl ::core::future::Future<Output = bool> + Send;
option_arg( &mut self, a: Option<bool>, b: Option<()>, c: Option<u32>, d: Option<E1>, e: Option<f32>, g: Option<Option<bool>>, ) -> impl ::core::future::Future<Output = ()> + Send493                 fn option_arg(
494                     &mut self,
495                     a: Option<bool>,
496                     b: Option<()>,
497                     c: Option<u32>,
498                     d: Option<E1>,
499                     e: Option<f32>,
500                     g: Option<Option<bool>>,
501                 ) -> impl ::core::future::Future<Output = ()> + Send;
option_result( &mut self, ) -> impl ::core::future::Future< Output = ( Option<bool>, Option<()>, Option<u32>, Option<E1>, Option<f32>, Option<Option<bool>>, ), > + Send502                 fn option_result(
503                     &mut self,
504                 ) -> impl ::core::future::Future<
505                     Output = (
506                         Option<bool>,
507                         Option<()>,
508                         Option<u32>,
509                         Option<E1>,
510                         Option<f32>,
511                         Option<Option<bool>>,
512                     ),
513                 > + Send;
casts( &mut self, a: Casts1, b: Casts2, c: Casts3, d: Casts4, e: Casts5, f: Casts6, ) -> impl ::core::future::Future< Output = (Casts1, Casts2, Casts3, Casts4, Casts5, Casts6), > + Send514                 fn casts(
515                     &mut self,
516                     a: Casts1,
517                     b: Casts2,
518                     c: Casts3,
519                     d: Casts4,
520                     e: Casts5,
521                     f: Casts6,
522                 ) -> impl ::core::future::Future<
523                     Output = (Casts1, Casts2, Casts3, Casts4, Casts5, Casts6),
524                 > + Send;
result_arg( &mut self, a: Result<(), ()>, b: Result<(), E1>, c: Result<E1, ()>, d: Result<(), ()>, e: Result<u32, V1>, f: Result< wasmtime::component::__internal::String, wasmtime::component::__internal::Vec<u8>, >, ) -> impl ::core::future::Future<Output = ()> + Send525                 fn result_arg(
526                     &mut self,
527                     a: Result<(), ()>,
528                     b: Result<(), E1>,
529                     c: Result<E1, ()>,
530                     d: Result<(), ()>,
531                     e: Result<u32, V1>,
532                     f: Result<
533                         wasmtime::component::__internal::String,
534                         wasmtime::component::__internal::Vec<u8>,
535                     >,
536                 ) -> impl ::core::future::Future<Output = ()> + Send;
result_result( &mut self, ) -> impl ::core::future::Future< Output = ( Result<(), ()>, Result<(), E1>, Result<E1, ()>, Result<(), ()>, Result<u32, V1>, Result< wasmtime::component::__internal::String, wasmtime::component::__internal::Vec<u8>, >, ), > + Send537                 fn result_result(
538                     &mut self,
539                 ) -> impl ::core::future::Future<
540                     Output = (
541                         Result<(), ()>,
542                         Result<(), E1>,
543                         Result<E1, ()>,
544                         Result<(), ()>,
545                         Result<u32, V1>,
546                         Result<
547                             wasmtime::component::__internal::String,
548                             wasmtime::component::__internal::Vec<u8>,
549                         >,
550                     ),
551                 > + Send;
return_result_sugar( &mut self, ) -> impl ::core::future::Future<Output = Result<i32, MyErrno>> + Send552                 fn return_result_sugar(
553                     &mut self,
554                 ) -> impl ::core::future::Future<Output = Result<i32, MyErrno>> + Send;
return_result_sugar2( &mut self, ) -> impl ::core::future::Future<Output = Result<(), MyErrno>> + Send555                 fn return_result_sugar2(
556                     &mut self,
557                 ) -> impl ::core::future::Future<Output = Result<(), MyErrno>> + Send;
return_result_sugar3( &mut self, ) -> impl ::core::future::Future< Output = Result<MyErrno, MyErrno>, > + Send558                 fn return_result_sugar3(
559                     &mut self,
560                 ) -> impl ::core::future::Future<
561                     Output = Result<MyErrno, MyErrno>,
562                 > + Send;
return_result_sugar4( &mut self, ) -> impl ::core::future::Future< Output = Result<(i32, u32), MyErrno>, > + Send563                 fn return_result_sugar4(
564                     &mut self,
565                 ) -> impl ::core::future::Future<
566                     Output = Result<(i32, u32), MyErrno>,
567                 > + Send;
return_option_sugar( &mut self, ) -> impl ::core::future::Future<Output = Option<i32>> + Send568                 fn return_option_sugar(
569                     &mut self,
570                 ) -> impl ::core::future::Future<Output = Option<i32>> + Send;
return_option_sugar2( &mut self, ) -> impl ::core::future::Future<Output = Option<MyErrno>> + Send571                 fn return_option_sugar2(
572                     &mut self,
573                 ) -> impl ::core::future::Future<Output = Option<MyErrno>> + Send;
result_simple( &mut self, ) -> impl ::core::future::Future<Output = Result<u32, i32>> + Send574                 fn result_simple(
575                     &mut self,
576                 ) -> impl ::core::future::Future<Output = Result<u32, i32>> + Send;
is_clone_arg( &mut self, a: IsClone, ) -> impl ::core::future::Future<Output = ()> + Send577                 fn is_clone_arg(
578                     &mut self,
579                     a: IsClone,
580                 ) -> impl ::core::future::Future<Output = ()> + Send;
is_clone_return( &mut self, ) -> impl ::core::future::Future<Output = IsClone> + Send581                 fn is_clone_return(
582                     &mut self,
583                 ) -> impl ::core::future::Future<Output = IsClone> + Send;
584             }
585             impl<_T: Host + ?Sized + Send> Host for &mut _T {
e1_arg( &mut self, x: E1, ) -> impl ::core::future::Future<Output = ()> + Send586                 fn e1_arg(
587                     &mut self,
588                     x: E1,
589                 ) -> impl ::core::future::Future<Output = ()> + Send {
590                     async move { Host::e1_arg(*self, x).await }
591                 }
e1_result( &mut self, ) -> impl ::core::future::Future<Output = E1> + Send592                 fn e1_result(
593                     &mut self,
594                 ) -> impl ::core::future::Future<Output = E1> + Send {
595                     async move { Host::e1_result(*self).await }
596                 }
v1_arg( &mut self, x: V1, ) -> impl ::core::future::Future<Output = ()> + Send597                 fn v1_arg(
598                     &mut self,
599                     x: V1,
600                 ) -> impl ::core::future::Future<Output = ()> + Send {
601                     async move { Host::v1_arg(*self, x).await }
602                 }
v1_result( &mut self, ) -> impl ::core::future::Future<Output = V1> + Send603                 fn v1_result(
604                     &mut self,
605                 ) -> impl ::core::future::Future<Output = V1> + Send {
606                     async move { Host::v1_result(*self).await }
607                 }
bool_arg( &mut self, x: bool, ) -> impl ::core::future::Future<Output = ()> + Send608                 fn bool_arg(
609                     &mut self,
610                     x: bool,
611                 ) -> impl ::core::future::Future<Output = ()> + Send {
612                     async move { Host::bool_arg(*self, x).await }
613                 }
bool_result( &mut self, ) -> impl ::core::future::Future<Output = bool> + Send614                 fn bool_result(
615                     &mut self,
616                 ) -> impl ::core::future::Future<Output = bool> + Send {
617                     async move { Host::bool_result(*self).await }
618                 }
option_arg( &mut self, a: Option<bool>, b: Option<()>, c: Option<u32>, d: Option<E1>, e: Option<f32>, g: Option<Option<bool>>, ) -> impl ::core::future::Future<Output = ()> + Send619                 fn option_arg(
620                     &mut self,
621                     a: Option<bool>,
622                     b: Option<()>,
623                     c: Option<u32>,
624                     d: Option<E1>,
625                     e: Option<f32>,
626                     g: Option<Option<bool>>,
627                 ) -> impl ::core::future::Future<Output = ()> + Send {
628                     async move { Host::option_arg(*self, a, b, c, d, e, g).await }
629                 }
option_result( &mut self, ) -> impl ::core::future::Future< Output = ( Option<bool>, Option<()>, Option<u32>, Option<E1>, Option<f32>, Option<Option<bool>>, ), > + Send630                 fn option_result(
631                     &mut self,
632                 ) -> impl ::core::future::Future<
633                     Output = (
634                         Option<bool>,
635                         Option<()>,
636                         Option<u32>,
637                         Option<E1>,
638                         Option<f32>,
639                         Option<Option<bool>>,
640                     ),
641                 > + Send {
642                     async move { Host::option_result(*self).await }
643                 }
casts( &mut self, a: Casts1, b: Casts2, c: Casts3, d: Casts4, e: Casts5, f: Casts6, ) -> impl ::core::future::Future< Output = (Casts1, Casts2, Casts3, Casts4, Casts5, Casts6), > + Send644                 fn casts(
645                     &mut self,
646                     a: Casts1,
647                     b: Casts2,
648                     c: Casts3,
649                     d: Casts4,
650                     e: Casts5,
651                     f: Casts6,
652                 ) -> impl ::core::future::Future<
653                     Output = (Casts1, Casts2, Casts3, Casts4, Casts5, Casts6),
654                 > + Send {
655                     async move { Host::casts(*self, a, b, c, d, e, f).await }
656                 }
result_arg( &mut self, a: Result<(), ()>, b: Result<(), E1>, c: Result<E1, ()>, d: Result<(), ()>, e: Result<u32, V1>, f: Result< wasmtime::component::__internal::String, wasmtime::component::__internal::Vec<u8>, >, ) -> impl ::core::future::Future<Output = ()> + Send657                 fn result_arg(
658                     &mut self,
659                     a: Result<(), ()>,
660                     b: Result<(), E1>,
661                     c: Result<E1, ()>,
662                     d: Result<(), ()>,
663                     e: Result<u32, V1>,
664                     f: Result<
665                         wasmtime::component::__internal::String,
666                         wasmtime::component::__internal::Vec<u8>,
667                     >,
668                 ) -> impl ::core::future::Future<Output = ()> + Send {
669                     async move { Host::result_arg(*self, a, b, c, d, e, f).await }
670                 }
result_result( &mut self, ) -> impl ::core::future::Future< Output = ( Result<(), ()>, Result<(), E1>, Result<E1, ()>, Result<(), ()>, Result<u32, V1>, Result< wasmtime::component::__internal::String, wasmtime::component::__internal::Vec<u8>, >, ), > + Send671                 fn result_result(
672                     &mut self,
673                 ) -> impl ::core::future::Future<
674                     Output = (
675                         Result<(), ()>,
676                         Result<(), E1>,
677                         Result<E1, ()>,
678                         Result<(), ()>,
679                         Result<u32, V1>,
680                         Result<
681                             wasmtime::component::__internal::String,
682                             wasmtime::component::__internal::Vec<u8>,
683                         >,
684                     ),
685                 > + Send {
686                     async move { Host::result_result(*self).await }
687                 }
return_result_sugar( &mut self, ) -> impl ::core::future::Future<Output = Result<i32, MyErrno>> + Send688                 fn return_result_sugar(
689                     &mut self,
690                 ) -> impl ::core::future::Future<Output = Result<i32, MyErrno>> + Send {
691                     async move { Host::return_result_sugar(*self).await }
692                 }
return_result_sugar2( &mut self, ) -> impl ::core::future::Future<Output = Result<(), MyErrno>> + Send693                 fn return_result_sugar2(
694                     &mut self,
695                 ) -> impl ::core::future::Future<Output = Result<(), MyErrno>> + Send {
696                     async move { Host::return_result_sugar2(*self).await }
697                 }
return_result_sugar3( &mut self, ) -> impl ::core::future::Future< Output = Result<MyErrno, MyErrno>, > + Send698                 fn return_result_sugar3(
699                     &mut self,
700                 ) -> impl ::core::future::Future<
701                     Output = Result<MyErrno, MyErrno>,
702                 > + Send {
703                     async move { Host::return_result_sugar3(*self).await }
704                 }
return_result_sugar4( &mut self, ) -> impl ::core::future::Future< Output = Result<(i32, u32), MyErrno>, > + Send705                 fn return_result_sugar4(
706                     &mut self,
707                 ) -> impl ::core::future::Future<
708                     Output = Result<(i32, u32), MyErrno>,
709                 > + Send {
710                     async move { Host::return_result_sugar4(*self).await }
711                 }
return_option_sugar( &mut self, ) -> impl ::core::future::Future<Output = Option<i32>> + Send712                 fn return_option_sugar(
713                     &mut self,
714                 ) -> impl ::core::future::Future<Output = Option<i32>> + Send {
715                     async move { Host::return_option_sugar(*self).await }
716                 }
return_option_sugar2( &mut self, ) -> impl ::core::future::Future<Output = Option<MyErrno>> + Send717                 fn return_option_sugar2(
718                     &mut self,
719                 ) -> impl ::core::future::Future<Output = Option<MyErrno>> + Send {
720                     async move { Host::return_option_sugar2(*self).await }
721                 }
result_simple( &mut self, ) -> impl ::core::future::Future<Output = Result<u32, i32>> + Send722                 fn result_simple(
723                     &mut self,
724                 ) -> impl ::core::future::Future<Output = Result<u32, i32>> + Send {
725                     async move { Host::result_simple(*self).await }
726                 }
is_clone_arg( &mut self, a: IsClone, ) -> impl ::core::future::Future<Output = ()> + Send727                 fn is_clone_arg(
728                     &mut self,
729                     a: IsClone,
730                 ) -> impl ::core::future::Future<Output = ()> + Send {
731                     async move { Host::is_clone_arg(*self, a).await }
732                 }
is_clone_return( &mut self, ) -> impl ::core::future::Future<Output = IsClone> + Send733                 fn is_clone_return(
734                     &mut self,
735                 ) -> impl ::core::future::Future<Output = IsClone> + Send {
736                     async move { Host::is_clone_return(*self).await }
737                 }
738             }
add_to_linker<T, D>( linker: &mut wasmtime::component::Linker<T>, host_getter: fn(&mut T) -> D::Data<'_>, ) -> wasmtime::Result<()> where D: HostWithStore, for<'a> D::Data<'a>: Host, T: 'static + Send,739             pub fn add_to_linker<T, D>(
740                 linker: &mut wasmtime::component::Linker<T>,
741                 host_getter: fn(&mut T) -> D::Data<'_>,
742             ) -> wasmtime::Result<()>
743             where
744                 D: HostWithStore,
745                 for<'a> D::Data<'a>: Host,
746                 T: 'static + Send,
747             {
748                 let mut inst = linker.instance("foo:foo/variants")?;
749                 inst.func_wrap_async(
750                     "e1-arg",
751                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (E1,)| {
752                         use tracing::Instrument;
753                         let span = tracing::span!(
754                             tracing::Level::TRACE, "wit-bindgen import", module =
755                             "variants", function = "e1-arg",
756                         );
757                         wasmtime::component::__internal::Box::new(
758                             async move {
759                                 tracing::event!(
760                                     tracing::Level::TRACE, x = tracing::field::debug(& arg0),
761                                     "call"
762                                 );
763                                 let host = &mut host_getter(caller.data_mut());
764                                 let r = Host::e1_arg(host, arg0).await;
765                                 tracing::event!(
766                                     tracing::Level::TRACE, result = tracing::field::debug(& r),
767                                     "return"
768                                 );
769                                 Ok(r)
770                             }
771                                 .instrument(span),
772                         )
773                     },
774                 )?;
775                 inst.func_wrap_async(
776                     "e1-result",
777                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
778                         use tracing::Instrument;
779                         let span = tracing::span!(
780                             tracing::Level::TRACE, "wit-bindgen import", module =
781                             "variants", function = "e1-result",
782                         );
783                         wasmtime::component::__internal::Box::new(
784                             async move {
785                                 tracing::event!(tracing::Level::TRACE, "call");
786                                 let host = &mut host_getter(caller.data_mut());
787                                 let r = Host::e1_result(host).await;
788                                 tracing::event!(
789                                     tracing::Level::TRACE, result = tracing::field::debug(& r),
790                                     "return"
791                                 );
792                                 Ok((r,))
793                             }
794                                 .instrument(span),
795                         )
796                     },
797                 )?;
798                 inst.func_wrap_async(
799                     "v1-arg",
800                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (V1,)| {
801                         use tracing::Instrument;
802                         let span = tracing::span!(
803                             tracing::Level::TRACE, "wit-bindgen import", module =
804                             "variants", function = "v1-arg",
805                         );
806                         wasmtime::component::__internal::Box::new(
807                             async move {
808                                 tracing::event!(
809                                     tracing::Level::TRACE, x = tracing::field::debug(& arg0),
810                                     "call"
811                                 );
812                                 let host = &mut host_getter(caller.data_mut());
813                                 let r = Host::v1_arg(host, arg0).await;
814                                 tracing::event!(
815                                     tracing::Level::TRACE, result = tracing::field::debug(& r),
816                                     "return"
817                                 );
818                                 Ok(r)
819                             }
820                                 .instrument(span),
821                         )
822                     },
823                 )?;
824                 inst.func_wrap_async(
825                     "v1-result",
826                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
827                         use tracing::Instrument;
828                         let span = tracing::span!(
829                             tracing::Level::TRACE, "wit-bindgen import", module =
830                             "variants", function = "v1-result",
831                         );
832                         wasmtime::component::__internal::Box::new(
833                             async move {
834                                 tracing::event!(tracing::Level::TRACE, "call");
835                                 let host = &mut host_getter(caller.data_mut());
836                                 let r = Host::v1_result(host).await;
837                                 tracing::event!(
838                                     tracing::Level::TRACE, result = tracing::field::debug(& r),
839                                     "return"
840                                 );
841                                 Ok((r,))
842                             }
843                                 .instrument(span),
844                         )
845                     },
846                 )?;
847                 inst.func_wrap_async(
848                     "bool-arg",
849                     move |
850                         mut caller: wasmtime::StoreContextMut<'_, T>,
851                         (arg0,): (bool,)|
852                     {
853                         use tracing::Instrument;
854                         let span = tracing::span!(
855                             tracing::Level::TRACE, "wit-bindgen import", module =
856                             "variants", function = "bool-arg",
857                         );
858                         wasmtime::component::__internal::Box::new(
859                             async move {
860                                 tracing::event!(
861                                     tracing::Level::TRACE, x = tracing::field::debug(& arg0),
862                                     "call"
863                                 );
864                                 let host = &mut host_getter(caller.data_mut());
865                                 let r = Host::bool_arg(host, arg0).await;
866                                 tracing::event!(
867                                     tracing::Level::TRACE, result = tracing::field::debug(& r),
868                                     "return"
869                                 );
870                                 Ok(r)
871                             }
872                                 .instrument(span),
873                         )
874                     },
875                 )?;
876                 inst.func_wrap_async(
877                     "bool-result",
878                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
879                         use tracing::Instrument;
880                         let span = tracing::span!(
881                             tracing::Level::TRACE, "wit-bindgen import", module =
882                             "variants", function = "bool-result",
883                         );
884                         wasmtime::component::__internal::Box::new(
885                             async move {
886                                 tracing::event!(tracing::Level::TRACE, "call");
887                                 let host = &mut host_getter(caller.data_mut());
888                                 let r = Host::bool_result(host).await;
889                                 tracing::event!(
890                                     tracing::Level::TRACE, result = tracing::field::debug(& r),
891                                     "return"
892                                 );
893                                 Ok((r,))
894                             }
895                                 .instrument(span),
896                         )
897                     },
898                 )?;
899                 inst.func_wrap_async(
900                     "option-arg",
901                     move |
902                         mut caller: wasmtime::StoreContextMut<'_, T>,
903                         (
904                             arg0,
905                             arg1,
906                             arg2,
907                             arg3,
908                             arg4,
909                             arg5,
910                         ): (
911                             Option<bool>,
912                             Option<()>,
913                             Option<u32>,
914                             Option<E1>,
915                             Option<f32>,
916                             Option<Option<bool>>,
917                         )|
918                     {
919                         use tracing::Instrument;
920                         let span = tracing::span!(
921                             tracing::Level::TRACE, "wit-bindgen import", module =
922                             "variants", function = "option-arg",
923                         );
924                         wasmtime::component::__internal::Box::new(
925                             async move {
926                                 tracing::event!(
927                                     tracing::Level::TRACE, a = tracing::field::debug(& arg0), b
928                                     = tracing::field::debug(& arg1), c = tracing::field::debug(&
929                                     arg2), d = tracing::field::debug(& arg3), e =
930                                     tracing::field::debug(& arg4), g = tracing::field::debug(&
931                                     arg5), "call"
932                                 );
933                                 let host = &mut host_getter(caller.data_mut());
934                                 let r = Host::option_arg(
935                                         host,
936                                         arg0,
937                                         arg1,
938                                         arg2,
939                                         arg3,
940                                         arg4,
941                                         arg5,
942                                     )
943                                     .await;
944                                 tracing::event!(
945                                     tracing::Level::TRACE, result = tracing::field::debug(& r),
946                                     "return"
947                                 );
948                                 Ok(r)
949                             }
950                                 .instrument(span),
951                         )
952                     },
953                 )?;
954                 inst.func_wrap_async(
955                     "option-result",
956                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
957                         use tracing::Instrument;
958                         let span = tracing::span!(
959                             tracing::Level::TRACE, "wit-bindgen import", module =
960                             "variants", function = "option-result",
961                         );
962                         wasmtime::component::__internal::Box::new(
963                             async move {
964                                 tracing::event!(tracing::Level::TRACE, "call");
965                                 let host = &mut host_getter(caller.data_mut());
966                                 let r = Host::option_result(host).await;
967                                 tracing::event!(
968                                     tracing::Level::TRACE, result = tracing::field::debug(& r),
969                                     "return"
970                                 );
971                                 Ok((r,))
972                             }
973                                 .instrument(span),
974                         )
975                     },
976                 )?;
977                 inst.func_wrap_async(
978                     "casts",
979                     move |
980                         mut caller: wasmtime::StoreContextMut<'_, T>,
981                         (
982                             arg0,
983                             arg1,
984                             arg2,
985                             arg3,
986                             arg4,
987                             arg5,
988                         ): (Casts1, Casts2, Casts3, Casts4, Casts5, Casts6)|
989                     {
990                         use tracing::Instrument;
991                         let span = tracing::span!(
992                             tracing::Level::TRACE, "wit-bindgen import", module =
993                             "variants", function = "casts",
994                         );
995                         wasmtime::component::__internal::Box::new(
996                             async move {
997                                 tracing::event!(
998                                     tracing::Level::TRACE, a = tracing::field::debug(& arg0), b
999                                     = tracing::field::debug(& arg1), c = tracing::field::debug(&
1000                                     arg2), d = tracing::field::debug(& arg3), e =
1001                                     tracing::field::debug(& arg4), f = tracing::field::debug(&
1002                                     arg5), "call"
1003                                 );
1004                                 let host = &mut host_getter(caller.data_mut());
1005                                 let r = Host::casts(
1006                                         host,
1007                                         arg0,
1008                                         arg1,
1009                                         arg2,
1010                                         arg3,
1011                                         arg4,
1012                                         arg5,
1013                                     )
1014                                     .await;
1015                                 tracing::event!(
1016                                     tracing::Level::TRACE, result = tracing::field::debug(& r),
1017                                     "return"
1018                                 );
1019                                 Ok((r,))
1020                             }
1021                                 .instrument(span),
1022                         )
1023                     },
1024                 )?;
1025                 inst.func_wrap_async(
1026                     "result-arg",
1027                     move |
1028                         mut caller: wasmtime::StoreContextMut<'_, T>,
1029                         (
1030                             arg0,
1031                             arg1,
1032                             arg2,
1033                             arg3,
1034                             arg4,
1035                             arg5,
1036                         ): (
1037                             Result<(), ()>,
1038                             Result<(), E1>,
1039                             Result<E1, ()>,
1040                             Result<(), ()>,
1041                             Result<u32, V1>,
1042                             Result<
1043                                 wasmtime::component::__internal::String,
1044                                 wasmtime::component::__internal::Vec<u8>,
1045                             >,
1046                         )|
1047                     {
1048                         use tracing::Instrument;
1049                         let span = tracing::span!(
1050                             tracing::Level::TRACE, "wit-bindgen import", module =
1051                             "variants", function = "result-arg",
1052                         );
1053                         wasmtime::component::__internal::Box::new(
1054                             async move {
1055                                 tracing::event!(
1056                                     tracing::Level::TRACE, a = tracing::field::debug(& arg0), b
1057                                     = tracing::field::debug(& arg1), c = tracing::field::debug(&
1058                                     arg2), d = tracing::field::debug(& arg3), e =
1059                                     tracing::field::debug(& arg4), f =
1060                                     tracing::field::debug("..."), "call"
1061                                 );
1062                                 let host = &mut host_getter(caller.data_mut());
1063                                 let r = Host::result_arg(
1064                                         host,
1065                                         arg0,
1066                                         arg1,
1067                                         arg2,
1068                                         arg3,
1069                                         arg4,
1070                                         arg5,
1071                                     )
1072                                     .await;
1073                                 tracing::event!(
1074                                     tracing::Level::TRACE, result = tracing::field::debug(& r),
1075                                     "return"
1076                                 );
1077                                 Ok(r)
1078                             }
1079                                 .instrument(span),
1080                         )
1081                     },
1082                 )?;
1083                 inst.func_wrap_async(
1084                     "result-result",
1085                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
1086                         use tracing::Instrument;
1087                         let span = tracing::span!(
1088                             tracing::Level::TRACE, "wit-bindgen import", module =
1089                             "variants", function = "result-result",
1090                         );
1091                         wasmtime::component::__internal::Box::new(
1092                             async move {
1093                                 tracing::event!(tracing::Level::TRACE, "call");
1094                                 let host = &mut host_getter(caller.data_mut());
1095                                 let r = Host::result_result(host).await;
1096                                 tracing::event!(
1097                                     tracing::Level::TRACE, result =
1098                                     tracing::field::debug("..."), "return"
1099                                 );
1100                                 Ok((r,))
1101                             }
1102                                 .instrument(span),
1103                         )
1104                     },
1105                 )?;
1106                 inst.func_wrap_async(
1107                     "return-result-sugar",
1108                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
1109                         use tracing::Instrument;
1110                         let span = tracing::span!(
1111                             tracing::Level::TRACE, "wit-bindgen import", module =
1112                             "variants", function = "return-result-sugar",
1113                         );
1114                         wasmtime::component::__internal::Box::new(
1115                             async move {
1116                                 tracing::event!(tracing::Level::TRACE, "call");
1117                                 let host = &mut host_getter(caller.data_mut());
1118                                 let r = Host::return_result_sugar(host).await;
1119                                 tracing::event!(
1120                                     tracing::Level::TRACE, result = tracing::field::debug(& r),
1121                                     "return"
1122                                 );
1123                                 Ok((r,))
1124                             }
1125                                 .instrument(span),
1126                         )
1127                     },
1128                 )?;
1129                 inst.func_wrap_async(
1130                     "return-result-sugar2",
1131                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
1132                         use tracing::Instrument;
1133                         let span = tracing::span!(
1134                             tracing::Level::TRACE, "wit-bindgen import", module =
1135                             "variants", function = "return-result-sugar2",
1136                         );
1137                         wasmtime::component::__internal::Box::new(
1138                             async move {
1139                                 tracing::event!(tracing::Level::TRACE, "call");
1140                                 let host = &mut host_getter(caller.data_mut());
1141                                 let r = Host::return_result_sugar2(host).await;
1142                                 tracing::event!(
1143                                     tracing::Level::TRACE, result = tracing::field::debug(& r),
1144                                     "return"
1145                                 );
1146                                 Ok((r,))
1147                             }
1148                                 .instrument(span),
1149                         )
1150                     },
1151                 )?;
1152                 inst.func_wrap_async(
1153                     "return-result-sugar3",
1154                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
1155                         use tracing::Instrument;
1156                         let span = tracing::span!(
1157                             tracing::Level::TRACE, "wit-bindgen import", module =
1158                             "variants", function = "return-result-sugar3",
1159                         );
1160                         wasmtime::component::__internal::Box::new(
1161                             async move {
1162                                 tracing::event!(tracing::Level::TRACE, "call");
1163                                 let host = &mut host_getter(caller.data_mut());
1164                                 let r = Host::return_result_sugar3(host).await;
1165                                 tracing::event!(
1166                                     tracing::Level::TRACE, result = tracing::field::debug(& r),
1167                                     "return"
1168                                 );
1169                                 Ok((r,))
1170                             }
1171                                 .instrument(span),
1172                         )
1173                     },
1174                 )?;
1175                 inst.func_wrap_async(
1176                     "return-result-sugar4",
1177                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
1178                         use tracing::Instrument;
1179                         let span = tracing::span!(
1180                             tracing::Level::TRACE, "wit-bindgen import", module =
1181                             "variants", function = "return-result-sugar4",
1182                         );
1183                         wasmtime::component::__internal::Box::new(
1184                             async move {
1185                                 tracing::event!(tracing::Level::TRACE, "call");
1186                                 let host = &mut host_getter(caller.data_mut());
1187                                 let r = Host::return_result_sugar4(host).await;
1188                                 tracing::event!(
1189                                     tracing::Level::TRACE, result = tracing::field::debug(& r),
1190                                     "return"
1191                                 );
1192                                 Ok((r,))
1193                             }
1194                                 .instrument(span),
1195                         )
1196                     },
1197                 )?;
1198                 inst.func_wrap_async(
1199                     "return-option-sugar",
1200                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
1201                         use tracing::Instrument;
1202                         let span = tracing::span!(
1203                             tracing::Level::TRACE, "wit-bindgen import", module =
1204                             "variants", function = "return-option-sugar",
1205                         );
1206                         wasmtime::component::__internal::Box::new(
1207                             async move {
1208                                 tracing::event!(tracing::Level::TRACE, "call");
1209                                 let host = &mut host_getter(caller.data_mut());
1210                                 let r = Host::return_option_sugar(host).await;
1211                                 tracing::event!(
1212                                     tracing::Level::TRACE, result = tracing::field::debug(& r),
1213                                     "return"
1214                                 );
1215                                 Ok((r,))
1216                             }
1217                                 .instrument(span),
1218                         )
1219                     },
1220                 )?;
1221                 inst.func_wrap_async(
1222                     "return-option-sugar2",
1223                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
1224                         use tracing::Instrument;
1225                         let span = tracing::span!(
1226                             tracing::Level::TRACE, "wit-bindgen import", module =
1227                             "variants", function = "return-option-sugar2",
1228                         );
1229                         wasmtime::component::__internal::Box::new(
1230                             async move {
1231                                 tracing::event!(tracing::Level::TRACE, "call");
1232                                 let host = &mut host_getter(caller.data_mut());
1233                                 let r = Host::return_option_sugar2(host).await;
1234                                 tracing::event!(
1235                                     tracing::Level::TRACE, result = tracing::field::debug(& r),
1236                                     "return"
1237                                 );
1238                                 Ok((r,))
1239                             }
1240                                 .instrument(span),
1241                         )
1242                     },
1243                 )?;
1244                 inst.func_wrap_async(
1245                     "result-simple",
1246                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
1247                         use tracing::Instrument;
1248                         let span = tracing::span!(
1249                             tracing::Level::TRACE, "wit-bindgen import", module =
1250                             "variants", function = "result-simple",
1251                         );
1252                         wasmtime::component::__internal::Box::new(
1253                             async move {
1254                                 tracing::event!(tracing::Level::TRACE, "call");
1255                                 let host = &mut host_getter(caller.data_mut());
1256                                 let r = Host::result_simple(host).await;
1257                                 tracing::event!(
1258                                     tracing::Level::TRACE, result = tracing::field::debug(& r),
1259                                     "return"
1260                                 );
1261                                 Ok((r,))
1262                             }
1263                                 .instrument(span),
1264                         )
1265                     },
1266                 )?;
1267                 inst.func_wrap_async(
1268                     "is-clone-arg",
1269                     move |
1270                         mut caller: wasmtime::StoreContextMut<'_, T>,
1271                         (arg0,): (IsClone,)|
1272                     {
1273                         use tracing::Instrument;
1274                         let span = tracing::span!(
1275                             tracing::Level::TRACE, "wit-bindgen import", module =
1276                             "variants", function = "is-clone-arg",
1277                         );
1278                         wasmtime::component::__internal::Box::new(
1279                             async move {
1280                                 tracing::event!(
1281                                     tracing::Level::TRACE, a = tracing::field::debug(& arg0),
1282                                     "call"
1283                                 );
1284                                 let host = &mut host_getter(caller.data_mut());
1285                                 let r = Host::is_clone_arg(host, arg0).await;
1286                                 tracing::event!(
1287                                     tracing::Level::TRACE, result = tracing::field::debug(& r),
1288                                     "return"
1289                                 );
1290                                 Ok(r)
1291                             }
1292                                 .instrument(span),
1293                         )
1294                     },
1295                 )?;
1296                 inst.func_wrap_async(
1297                     "is-clone-return",
1298                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
1299                         use tracing::Instrument;
1300                         let span = tracing::span!(
1301                             tracing::Level::TRACE, "wit-bindgen import", module =
1302                             "variants", function = "is-clone-return",
1303                         );
1304                         wasmtime::component::__internal::Box::new(
1305                             async move {
1306                                 tracing::event!(tracing::Level::TRACE, "call");
1307                                 let host = &mut host_getter(caller.data_mut());
1308                                 let r = Host::is_clone_return(host).await;
1309                                 tracing::event!(
1310                                     tracing::Level::TRACE, result = tracing::field::debug(& r),
1311                                     "return"
1312                                 );
1313                                 Ok((r,))
1314                             }
1315                                 .instrument(span),
1316                         )
1317                     },
1318                 )?;
1319                 Ok(())
1320             }
1321         }
1322     }
1323 }
1324 pub mod exports {
1325     pub mod foo {
1326         pub mod foo {
1327             #[allow(clippy::all)]
1328             pub mod variants {
1329                 #[allow(unused_imports)]
1330                 use wasmtime::component::__internal::Box;
1331                 #[derive(wasmtime::component::ComponentType)]
1332                 #[derive(wasmtime::component::Lift)]
1333                 #[derive(wasmtime::component::Lower)]
1334                 #[component(enum)]
1335                 #[derive(Clone, Copy, Eq, PartialEq)]
1336                 #[repr(u8)]
1337                 pub enum E1 {
1338                     #[component(name = "a")]
1339                     A,
1340                 }
1341                 impl core::fmt::Debug for E1 {
fmt( &self, f: &mut core::fmt::Formatter<'_>, ) -> core::fmt::Result1342                     fn fmt(
1343                         &self,
1344                         f: &mut core::fmt::Formatter<'_>,
1345                     ) -> core::fmt::Result {
1346                         match self {
1347                             E1::A => f.debug_tuple("E1::A").finish(),
1348                         }
1349                     }
1350                 }
1351                 const _: () = {
1352                     assert!(1 == < E1 as wasmtime::component::ComponentType >::SIZE32);
1353                     assert!(1 == < E1 as wasmtime::component::ComponentType >::ALIGN32);
1354                 };
1355                 #[derive(wasmtime::component::ComponentType)]
1356                 #[derive(wasmtime::component::Lift)]
1357                 #[derive(wasmtime::component::Lower)]
1358                 #[component(record)]
1359                 #[derive(Clone, Copy)]
1360                 pub struct Empty {}
1361                 impl core::fmt::Debug for Empty {
fmt( &self, f: &mut core::fmt::Formatter<'_>, ) -> core::fmt::Result1362                     fn fmt(
1363                         &self,
1364                         f: &mut core::fmt::Formatter<'_>,
1365                     ) -> core::fmt::Result {
1366                         f.debug_struct("Empty").finish()
1367                     }
1368                 }
1369                 const _: () = {
1370                     assert!(
1371                         0 == < Empty as wasmtime::component::ComponentType >::SIZE32
1372                     );
1373                     assert!(
1374                         1 == < Empty as wasmtime::component::ComponentType >::ALIGN32
1375                     );
1376                 };
1377                 #[derive(wasmtime::component::ComponentType)]
1378                 #[derive(wasmtime::component::Lift)]
1379                 #[derive(wasmtime::component::Lower)]
1380                 #[component(variant)]
1381                 #[derive(Clone)]
1382                 pub enum V1 {
1383                     #[component(name = "a")]
1384                     A,
1385                     #[component(name = "c")]
1386                     C(E1),
1387                     #[component(name = "d")]
1388                     D(wasmtime::component::__internal::String),
1389                     #[component(name = "e")]
1390                     E(Empty),
1391                     #[component(name = "f")]
1392                     F,
1393                     #[component(name = "g")]
1394                     G(u32),
1395                 }
1396                 impl core::fmt::Debug for V1 {
fmt( &self, f: &mut core::fmt::Formatter<'_>, ) -> core::fmt::Result1397                     fn fmt(
1398                         &self,
1399                         f: &mut core::fmt::Formatter<'_>,
1400                     ) -> core::fmt::Result {
1401                         match self {
1402                             V1::A => f.debug_tuple("V1::A").finish(),
1403                             V1::C(e) => f.debug_tuple("V1::C").field(e).finish(),
1404                             V1::D(e) => f.debug_tuple("V1::D").field(e).finish(),
1405                             V1::E(e) => f.debug_tuple("V1::E").field(e).finish(),
1406                             V1::F => f.debug_tuple("V1::F").finish(),
1407                             V1::G(e) => f.debug_tuple("V1::G").field(e).finish(),
1408                         }
1409                     }
1410                 }
1411                 const _: () = {
1412                     assert!(12 == < V1 as wasmtime::component::ComponentType >::SIZE32);
1413                     assert!(4 == < V1 as wasmtime::component::ComponentType >::ALIGN32);
1414                 };
1415                 #[derive(wasmtime::component::ComponentType)]
1416                 #[derive(wasmtime::component::Lift)]
1417                 #[derive(wasmtime::component::Lower)]
1418                 #[component(variant)]
1419                 #[derive(Clone, Copy)]
1420                 pub enum Casts1 {
1421                     #[component(name = "a")]
1422                     A(i32),
1423                     #[component(name = "b")]
1424                     B(f32),
1425                 }
1426                 impl core::fmt::Debug for Casts1 {
fmt( &self, f: &mut core::fmt::Formatter<'_>, ) -> core::fmt::Result1427                     fn fmt(
1428                         &self,
1429                         f: &mut core::fmt::Formatter<'_>,
1430                     ) -> core::fmt::Result {
1431                         match self {
1432                             Casts1::A(e) => f.debug_tuple("Casts1::A").field(e).finish(),
1433                             Casts1::B(e) => f.debug_tuple("Casts1::B").field(e).finish(),
1434                         }
1435                     }
1436                 }
1437                 const _: () = {
1438                     assert!(
1439                         8 == < Casts1 as wasmtime::component::ComponentType >::SIZE32
1440                     );
1441                     assert!(
1442                         4 == < Casts1 as wasmtime::component::ComponentType >::ALIGN32
1443                     );
1444                 };
1445                 #[derive(wasmtime::component::ComponentType)]
1446                 #[derive(wasmtime::component::Lift)]
1447                 #[derive(wasmtime::component::Lower)]
1448                 #[component(variant)]
1449                 #[derive(Clone, Copy)]
1450                 pub enum Casts2 {
1451                     #[component(name = "a")]
1452                     A(f64),
1453                     #[component(name = "b")]
1454                     B(f32),
1455                 }
1456                 impl core::fmt::Debug for Casts2 {
fmt( &self, f: &mut core::fmt::Formatter<'_>, ) -> core::fmt::Result1457                     fn fmt(
1458                         &self,
1459                         f: &mut core::fmt::Formatter<'_>,
1460                     ) -> core::fmt::Result {
1461                         match self {
1462                             Casts2::A(e) => f.debug_tuple("Casts2::A").field(e).finish(),
1463                             Casts2::B(e) => f.debug_tuple("Casts2::B").field(e).finish(),
1464                         }
1465                     }
1466                 }
1467                 const _: () = {
1468                     assert!(
1469                         16 == < Casts2 as wasmtime::component::ComponentType >::SIZE32
1470                     );
1471                     assert!(
1472                         8 == < Casts2 as wasmtime::component::ComponentType >::ALIGN32
1473                     );
1474                 };
1475                 #[derive(wasmtime::component::ComponentType)]
1476                 #[derive(wasmtime::component::Lift)]
1477                 #[derive(wasmtime::component::Lower)]
1478                 #[component(variant)]
1479                 #[derive(Clone, Copy)]
1480                 pub enum Casts3 {
1481                     #[component(name = "a")]
1482                     A(f64),
1483                     #[component(name = "b")]
1484                     B(u64),
1485                 }
1486                 impl core::fmt::Debug for Casts3 {
fmt( &self, f: &mut core::fmt::Formatter<'_>, ) -> core::fmt::Result1487                     fn fmt(
1488                         &self,
1489                         f: &mut core::fmt::Formatter<'_>,
1490                     ) -> core::fmt::Result {
1491                         match self {
1492                             Casts3::A(e) => f.debug_tuple("Casts3::A").field(e).finish(),
1493                             Casts3::B(e) => f.debug_tuple("Casts3::B").field(e).finish(),
1494                         }
1495                     }
1496                 }
1497                 const _: () = {
1498                     assert!(
1499                         16 == < Casts3 as wasmtime::component::ComponentType >::SIZE32
1500                     );
1501                     assert!(
1502                         8 == < Casts3 as wasmtime::component::ComponentType >::ALIGN32
1503                     );
1504                 };
1505                 #[derive(wasmtime::component::ComponentType)]
1506                 #[derive(wasmtime::component::Lift)]
1507                 #[derive(wasmtime::component::Lower)]
1508                 #[component(variant)]
1509                 #[derive(Clone, Copy)]
1510                 pub enum Casts4 {
1511                     #[component(name = "a")]
1512                     A(u32),
1513                     #[component(name = "b")]
1514                     B(i64),
1515                 }
1516                 impl core::fmt::Debug for Casts4 {
fmt( &self, f: &mut core::fmt::Formatter<'_>, ) -> core::fmt::Result1517                     fn fmt(
1518                         &self,
1519                         f: &mut core::fmt::Formatter<'_>,
1520                     ) -> core::fmt::Result {
1521                         match self {
1522                             Casts4::A(e) => f.debug_tuple("Casts4::A").field(e).finish(),
1523                             Casts4::B(e) => f.debug_tuple("Casts4::B").field(e).finish(),
1524                         }
1525                     }
1526                 }
1527                 const _: () = {
1528                     assert!(
1529                         16 == < Casts4 as wasmtime::component::ComponentType >::SIZE32
1530                     );
1531                     assert!(
1532                         8 == < Casts4 as wasmtime::component::ComponentType >::ALIGN32
1533                     );
1534                 };
1535                 #[derive(wasmtime::component::ComponentType)]
1536                 #[derive(wasmtime::component::Lift)]
1537                 #[derive(wasmtime::component::Lower)]
1538                 #[component(variant)]
1539                 #[derive(Clone, Copy)]
1540                 pub enum Casts5 {
1541                     #[component(name = "a")]
1542                     A(f32),
1543                     #[component(name = "b")]
1544                     B(i64),
1545                 }
1546                 impl core::fmt::Debug for Casts5 {
fmt( &self, f: &mut core::fmt::Formatter<'_>, ) -> core::fmt::Result1547                     fn fmt(
1548                         &self,
1549                         f: &mut core::fmt::Formatter<'_>,
1550                     ) -> core::fmt::Result {
1551                         match self {
1552                             Casts5::A(e) => f.debug_tuple("Casts5::A").field(e).finish(),
1553                             Casts5::B(e) => f.debug_tuple("Casts5::B").field(e).finish(),
1554                         }
1555                     }
1556                 }
1557                 const _: () = {
1558                     assert!(
1559                         16 == < Casts5 as wasmtime::component::ComponentType >::SIZE32
1560                     );
1561                     assert!(
1562                         8 == < Casts5 as wasmtime::component::ComponentType >::ALIGN32
1563                     );
1564                 };
1565                 #[derive(wasmtime::component::ComponentType)]
1566                 #[derive(wasmtime::component::Lift)]
1567                 #[derive(wasmtime::component::Lower)]
1568                 #[component(variant)]
1569                 #[derive(Clone, Copy)]
1570                 pub enum Casts6 {
1571                     #[component(name = "a")]
1572                     A((f32, u32)),
1573                     #[component(name = "b")]
1574                     B((u32, u32)),
1575                 }
1576                 impl core::fmt::Debug for Casts6 {
fmt( &self, f: &mut core::fmt::Formatter<'_>, ) -> core::fmt::Result1577                     fn fmt(
1578                         &self,
1579                         f: &mut core::fmt::Formatter<'_>,
1580                     ) -> core::fmt::Result {
1581                         match self {
1582                             Casts6::A(e) => f.debug_tuple("Casts6::A").field(e).finish(),
1583                             Casts6::B(e) => f.debug_tuple("Casts6::B").field(e).finish(),
1584                         }
1585                     }
1586                 }
1587                 const _: () = {
1588                     assert!(
1589                         12 == < Casts6 as wasmtime::component::ComponentType >::SIZE32
1590                     );
1591                     assert!(
1592                         4 == < Casts6 as wasmtime::component::ComponentType >::ALIGN32
1593                     );
1594                 };
1595                 #[derive(wasmtime::component::ComponentType)]
1596                 #[derive(wasmtime::component::Lift)]
1597                 #[derive(wasmtime::component::Lower)]
1598                 #[component(enum)]
1599                 #[derive(Clone, Copy, Eq, PartialEq)]
1600                 #[repr(u8)]
1601                 pub enum MyErrno {
1602                     #[component(name = "bad1")]
1603                     Bad1,
1604                     #[component(name = "bad2")]
1605                     Bad2,
1606                 }
1607                 impl MyErrno {
name(&self) -> &'static str1608                     pub fn name(&self) -> &'static str {
1609                         match self {
1610                             MyErrno::Bad1 => "bad1",
1611                             MyErrno::Bad2 => "bad2",
1612                         }
1613                     }
message(&self) -> &'static str1614                     pub fn message(&self) -> &'static str {
1615                         match self {
1616                             MyErrno::Bad1 => "",
1617                             MyErrno::Bad2 => "",
1618                         }
1619                     }
1620                 }
1621                 impl core::fmt::Debug for MyErrno {
fmt( &self, f: &mut core::fmt::Formatter<'_>, ) -> core::fmt::Result1622                     fn fmt(
1623                         &self,
1624                         f: &mut core::fmt::Formatter<'_>,
1625                     ) -> core::fmt::Result {
1626                         f.debug_struct("MyErrno")
1627                             .field("code", &(*self as i32))
1628                             .field("name", &self.name())
1629                             .field("message", &self.message())
1630                             .finish()
1631                     }
1632                 }
1633                 impl core::fmt::Display for MyErrno {
fmt( &self, f: &mut core::fmt::Formatter<'_>, ) -> core::fmt::Result1634                     fn fmt(
1635                         &self,
1636                         f: &mut core::fmt::Formatter<'_>,
1637                     ) -> core::fmt::Result {
1638                         write!(f, "{} (error {})", self.name(), * self as i32)
1639                     }
1640                 }
1641                 impl core::error::Error for MyErrno {}
1642                 const _: () = {
1643                     assert!(
1644                         1 == < MyErrno as wasmtime::component::ComponentType >::SIZE32
1645                     );
1646                     assert!(
1647                         1 == < MyErrno as wasmtime::component::ComponentType >::ALIGN32
1648                     );
1649                 };
1650                 #[derive(wasmtime::component::ComponentType)]
1651                 #[derive(wasmtime::component::Lift)]
1652                 #[derive(wasmtime::component::Lower)]
1653                 #[component(record)]
1654                 #[derive(Clone)]
1655                 pub struct IsClone {
1656                     #[component(name = "v1")]
1657                     pub v1: V1,
1658                 }
1659                 impl core::fmt::Debug for IsClone {
fmt( &self, f: &mut core::fmt::Formatter<'_>, ) -> core::fmt::Result1660                     fn fmt(
1661                         &self,
1662                         f: &mut core::fmt::Formatter<'_>,
1663                     ) -> core::fmt::Result {
1664                         f.debug_struct("IsClone").field("v1", &self.v1).finish()
1665                     }
1666                 }
1667                 const _: () = {
1668                     assert!(
1669                         12 == < IsClone as wasmtime::component::ComponentType >::SIZE32
1670                     );
1671                     assert!(
1672                         4 == < IsClone as wasmtime::component::ComponentType >::ALIGN32
1673                     );
1674                 };
1675                 #[derive(Clone)]
1676                 pub struct Guest {
1677                     e1_arg: wasmtime::component::Func,
1678                     e1_result: wasmtime::component::Func,
1679                     v1_arg: wasmtime::component::Func,
1680                     v1_result: wasmtime::component::Func,
1681                     bool_arg: wasmtime::component::Func,
1682                     bool_result: wasmtime::component::Func,
1683                     option_arg: wasmtime::component::Func,
1684                     option_result: wasmtime::component::Func,
1685                     casts: wasmtime::component::Func,
1686                     result_arg: wasmtime::component::Func,
1687                     result_result: wasmtime::component::Func,
1688                     return_result_sugar: wasmtime::component::Func,
1689                     return_result_sugar2: wasmtime::component::Func,
1690                     return_result_sugar3: wasmtime::component::Func,
1691                     return_result_sugar4: wasmtime::component::Func,
1692                     return_option_sugar: wasmtime::component::Func,
1693                     return_option_sugar2: wasmtime::component::Func,
1694                     result_simple: wasmtime::component::Func,
1695                     is_clone_arg: wasmtime::component::Func,
1696                     is_clone_return: wasmtime::component::Func,
1697                 }
1698                 #[derive(Clone)]
1699                 pub struct GuestIndices {
1700                     e1_arg: wasmtime::component::ComponentExportIndex,
1701                     e1_result: wasmtime::component::ComponentExportIndex,
1702                     v1_arg: wasmtime::component::ComponentExportIndex,
1703                     v1_result: wasmtime::component::ComponentExportIndex,
1704                     bool_arg: wasmtime::component::ComponentExportIndex,
1705                     bool_result: wasmtime::component::ComponentExportIndex,
1706                     option_arg: wasmtime::component::ComponentExportIndex,
1707                     option_result: wasmtime::component::ComponentExportIndex,
1708                     casts: wasmtime::component::ComponentExportIndex,
1709                     result_arg: wasmtime::component::ComponentExportIndex,
1710                     result_result: wasmtime::component::ComponentExportIndex,
1711                     return_result_sugar: wasmtime::component::ComponentExportIndex,
1712                     return_result_sugar2: wasmtime::component::ComponentExportIndex,
1713                     return_result_sugar3: wasmtime::component::ComponentExportIndex,
1714                     return_result_sugar4: wasmtime::component::ComponentExportIndex,
1715                     return_option_sugar: wasmtime::component::ComponentExportIndex,
1716                     return_option_sugar2: wasmtime::component::ComponentExportIndex,
1717                     result_simple: wasmtime::component::ComponentExportIndex,
1718                     is_clone_arg: wasmtime::component::ComponentExportIndex,
1719                     is_clone_return: wasmtime::component::ComponentExportIndex,
1720                 }
1721                 impl GuestIndices {
1722                     /// Constructor for [`GuestIndices`] which takes a
1723                     /// [`Component`](wasmtime::component::Component) as input and can be executed
1724                     /// before instantiation.
1725                     ///
1726                     /// This constructor can be used to front-load string lookups to find exports
1727                     /// within a component.
new<_T>( _instance_pre: &wasmtime::component::InstancePre<_T>, ) -> wasmtime::Result<GuestIndices>1728                     pub fn new<_T>(
1729                         _instance_pre: &wasmtime::component::InstancePre<_T>,
1730                     ) -> wasmtime::Result<GuestIndices> {
1731                         let instance = _instance_pre
1732                             .component()
1733                             .get_export_index(None, "foo:foo/variants")
1734                             .ok_or_else(|| {
1735                                 wasmtime::format_err!(
1736                                     "no exported instance named `foo:foo/variants`"
1737                                 )
1738                             })?;
1739                         let mut lookup = move |name| {
1740                             _instance_pre
1741                                 .component()
1742                                 .get_export_index(Some(&instance), name)
1743                                 .ok_or_else(|| {
1744                                     wasmtime::format_err!(
1745                                         "instance export `foo:foo/variants` does \
1746                                                             not have export `{name}`"
1747                                     )
1748                                 })
1749                         };
1750                         let _ = &mut lookup;
1751                         let e1_arg = lookup("e1-arg")?;
1752                         let e1_result = lookup("e1-result")?;
1753                         let v1_arg = lookup("v1-arg")?;
1754                         let v1_result = lookup("v1-result")?;
1755                         let bool_arg = lookup("bool-arg")?;
1756                         let bool_result = lookup("bool-result")?;
1757                         let option_arg = lookup("option-arg")?;
1758                         let option_result = lookup("option-result")?;
1759                         let casts = lookup("casts")?;
1760                         let result_arg = lookup("result-arg")?;
1761                         let result_result = lookup("result-result")?;
1762                         let return_result_sugar = lookup("return-result-sugar")?;
1763                         let return_result_sugar2 = lookup("return-result-sugar2")?;
1764                         let return_result_sugar3 = lookup("return-result-sugar3")?;
1765                         let return_result_sugar4 = lookup("return-result-sugar4")?;
1766                         let return_option_sugar = lookup("return-option-sugar")?;
1767                         let return_option_sugar2 = lookup("return-option-sugar2")?;
1768                         let result_simple = lookup("result-simple")?;
1769                         let is_clone_arg = lookup("is-clone-arg")?;
1770                         let is_clone_return = lookup("is-clone-return")?;
1771                         Ok(GuestIndices {
1772                             e1_arg,
1773                             e1_result,
1774                             v1_arg,
1775                             v1_result,
1776                             bool_arg,
1777                             bool_result,
1778                             option_arg,
1779                             option_result,
1780                             casts,
1781                             result_arg,
1782                             result_result,
1783                             return_result_sugar,
1784                             return_result_sugar2,
1785                             return_result_sugar3,
1786                             return_result_sugar4,
1787                             return_option_sugar,
1788                             return_option_sugar2,
1789                             result_simple,
1790                             is_clone_arg,
1791                             is_clone_return,
1792                         })
1793                     }
load( &self, mut store: impl wasmtime::AsContextMut, instance: &wasmtime::component::Instance, ) -> wasmtime::Result<Guest>1794                     pub fn load(
1795                         &self,
1796                         mut store: impl wasmtime::AsContextMut,
1797                         instance: &wasmtime::component::Instance,
1798                     ) -> wasmtime::Result<Guest> {
1799                         let _instance = instance;
1800                         let _instance_pre = _instance.instance_pre(&store);
1801                         let _instance_type = _instance_pre.instance_type();
1802                         let mut store = store.as_context_mut();
1803                         let _ = &mut store;
1804                         let e1_arg = *_instance
1805                             .get_typed_func::<(E1,), ()>(&mut store, &self.e1_arg)?
1806                             .func();
1807                         let e1_result = *_instance
1808                             .get_typed_func::<(), (E1,)>(&mut store, &self.e1_result)?
1809                             .func();
1810                         let v1_arg = *_instance
1811                             .get_typed_func::<(&V1,), ()>(&mut store, &self.v1_arg)?
1812                             .func();
1813                         let v1_result = *_instance
1814                             .get_typed_func::<(), (V1,)>(&mut store, &self.v1_result)?
1815                             .func();
1816                         let bool_arg = *_instance
1817                             .get_typed_func::<(bool,), ()>(&mut store, &self.bool_arg)?
1818                             .func();
1819                         let bool_result = *_instance
1820                             .get_typed_func::<
1821                                 (),
1822                                 (bool,),
1823                             >(&mut store, &self.bool_result)?
1824                             .func();
1825                         let option_arg = *_instance
1826                             .get_typed_func::<
1827                                 (
1828                                     Option<bool>,
1829                                     Option<()>,
1830                                     Option<u32>,
1831                                     Option<E1>,
1832                                     Option<f32>,
1833                                     Option<Option<bool>>,
1834                                 ),
1835                                 (),
1836                             >(&mut store, &self.option_arg)?
1837                             .func();
1838                         let option_result = *_instance
1839                             .get_typed_func::<
1840                                 (),
1841                                 (
1842                                     (
1843                                         Option<bool>,
1844                                         Option<()>,
1845                                         Option<u32>,
1846                                         Option<E1>,
1847                                         Option<f32>,
1848                                         Option<Option<bool>>,
1849                                     ),
1850                                 ),
1851                             >(&mut store, &self.option_result)?
1852                             .func();
1853                         let casts = *_instance
1854                             .get_typed_func::<
1855                                 (Casts1, Casts2, Casts3, Casts4, Casts5, Casts6),
1856                                 ((Casts1, Casts2, Casts3, Casts4, Casts5, Casts6),),
1857                             >(&mut store, &self.casts)?
1858                             .func();
1859                         let result_arg = *_instance
1860                             .get_typed_func::<
1861                                 (
1862                                     Result<(), ()>,
1863                                     Result<(), E1>,
1864                                     Result<E1, ()>,
1865                                     Result<(), ()>,
1866                                     Result<u32, &V1>,
1867                                     Result<&str, &[u8]>,
1868                                 ),
1869                                 (),
1870                             >(&mut store, &self.result_arg)?
1871                             .func();
1872                         let result_result = *_instance
1873                             .get_typed_func::<
1874                                 (),
1875                                 (
1876                                     (
1877                                         Result<(), ()>,
1878                                         Result<(), E1>,
1879                                         Result<E1, ()>,
1880                                         Result<(), ()>,
1881                                         Result<u32, V1>,
1882                                         Result<
1883                                             wasmtime::component::__internal::String,
1884                                             wasmtime::component::__internal::Vec<u8>,
1885                                         >,
1886                                     ),
1887                                 ),
1888                             >(&mut store, &self.result_result)?
1889                             .func();
1890                         let return_result_sugar = *_instance
1891                             .get_typed_func::<
1892                                 (),
1893                                 (Result<i32, MyErrno>,),
1894                             >(&mut store, &self.return_result_sugar)?
1895                             .func();
1896                         let return_result_sugar2 = *_instance
1897                             .get_typed_func::<
1898                                 (),
1899                                 (Result<(), MyErrno>,),
1900                             >(&mut store, &self.return_result_sugar2)?
1901                             .func();
1902                         let return_result_sugar3 = *_instance
1903                             .get_typed_func::<
1904                                 (),
1905                                 (Result<MyErrno, MyErrno>,),
1906                             >(&mut store, &self.return_result_sugar3)?
1907                             .func();
1908                         let return_result_sugar4 = *_instance
1909                             .get_typed_func::<
1910                                 (),
1911                                 (Result<(i32, u32), MyErrno>,),
1912                             >(&mut store, &self.return_result_sugar4)?
1913                             .func();
1914                         let return_option_sugar = *_instance
1915                             .get_typed_func::<
1916                                 (),
1917                                 (Option<i32>,),
1918                             >(&mut store, &self.return_option_sugar)?
1919                             .func();
1920                         let return_option_sugar2 = *_instance
1921                             .get_typed_func::<
1922                                 (),
1923                                 (Option<MyErrno>,),
1924                             >(&mut store, &self.return_option_sugar2)?
1925                             .func();
1926                         let result_simple = *_instance
1927                             .get_typed_func::<
1928                                 (),
1929                                 (Result<u32, i32>,),
1930                             >(&mut store, &self.result_simple)?
1931                             .func();
1932                         let is_clone_arg = *_instance
1933                             .get_typed_func::<
1934                                 (&IsClone,),
1935                                 (),
1936                             >(&mut store, &self.is_clone_arg)?
1937                             .func();
1938                         let is_clone_return = *_instance
1939                             .get_typed_func::<
1940                                 (),
1941                                 (IsClone,),
1942                             >(&mut store, &self.is_clone_return)?
1943                             .func();
1944                         Ok(Guest {
1945                             e1_arg,
1946                             e1_result,
1947                             v1_arg,
1948                             v1_result,
1949                             bool_arg,
1950                             bool_result,
1951                             option_arg,
1952                             option_result,
1953                             casts,
1954                             result_arg,
1955                             result_result,
1956                             return_result_sugar,
1957                             return_result_sugar2,
1958                             return_result_sugar3,
1959                             return_result_sugar4,
1960                             return_option_sugar,
1961                             return_option_sugar2,
1962                             result_simple,
1963                             is_clone_arg,
1964                             is_clone_return,
1965                         })
1966                     }
1967                 }
1968                 impl Guest {
call_e1_arg<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: E1, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,1969                     pub async fn call_e1_arg<S: wasmtime::AsContextMut>(
1970                         &self,
1971                         mut store: S,
1972                         arg0: E1,
1973                     ) -> wasmtime::Result<()>
1974                     where
1975                         <S as wasmtime::AsContext>::Data: Send,
1976                     {
1977                         use tracing::Instrument;
1978                         let span = tracing::span!(
1979                             tracing::Level::TRACE, "wit-bindgen export", module =
1980                             "foo:foo/variants", function = "e1-arg",
1981                         );
1982                         let callee = unsafe {
1983                             wasmtime::component::TypedFunc::<
1984                                 (E1,),
1985                                 (),
1986                             >::new_unchecked(self.e1_arg)
1987                         };
1988                         let () = callee
1989                             .call_async(store.as_context_mut(), (arg0,))
1990                             .instrument(span.clone())
1991                             .await?;
1992                         Ok(())
1993                     }
call_e1_result<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<E1> where <S as wasmtime::AsContext>::Data: Send,1994                     pub async fn call_e1_result<S: wasmtime::AsContextMut>(
1995                         &self,
1996                         mut store: S,
1997                     ) -> wasmtime::Result<E1>
1998                     where
1999                         <S as wasmtime::AsContext>::Data: Send,
2000                     {
2001                         use tracing::Instrument;
2002                         let span = tracing::span!(
2003                             tracing::Level::TRACE, "wit-bindgen export", module =
2004                             "foo:foo/variants", function = "e1-result",
2005                         );
2006                         let callee = unsafe {
2007                             wasmtime::component::TypedFunc::<
2008                                 (),
2009                                 (E1,),
2010                             >::new_unchecked(self.e1_result)
2011                         };
2012                         let (ret0,) = callee
2013                             .call_async(store.as_context_mut(), ())
2014                             .instrument(span.clone())
2015                             .await?;
2016                         Ok(ret0)
2017                     }
call_v1_arg<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: &V1, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,2018                     pub async fn call_v1_arg<S: wasmtime::AsContextMut>(
2019                         &self,
2020                         mut store: S,
2021                         arg0: &V1,
2022                     ) -> wasmtime::Result<()>
2023                     where
2024                         <S as wasmtime::AsContext>::Data: Send,
2025                     {
2026                         use tracing::Instrument;
2027                         let span = tracing::span!(
2028                             tracing::Level::TRACE, "wit-bindgen export", module =
2029                             "foo:foo/variants", function = "v1-arg",
2030                         );
2031                         let callee = unsafe {
2032                             wasmtime::component::TypedFunc::<
2033                                 (&V1,),
2034                                 (),
2035                             >::new_unchecked(self.v1_arg)
2036                         };
2037                         let () = callee
2038                             .call_async(store.as_context_mut(), (arg0,))
2039                             .instrument(span.clone())
2040                             .await?;
2041                         Ok(())
2042                     }
call_v1_result<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<V1> where <S as wasmtime::AsContext>::Data: Send,2043                     pub async fn call_v1_result<S: wasmtime::AsContextMut>(
2044                         &self,
2045                         mut store: S,
2046                     ) -> wasmtime::Result<V1>
2047                     where
2048                         <S as wasmtime::AsContext>::Data: Send,
2049                     {
2050                         use tracing::Instrument;
2051                         let span = tracing::span!(
2052                             tracing::Level::TRACE, "wit-bindgen export", module =
2053                             "foo:foo/variants", function = "v1-result",
2054                         );
2055                         let callee = unsafe {
2056                             wasmtime::component::TypedFunc::<
2057                                 (),
2058                                 (V1,),
2059                             >::new_unchecked(self.v1_result)
2060                         };
2061                         let (ret0,) = callee
2062                             .call_async(store.as_context_mut(), ())
2063                             .instrument(span.clone())
2064                             .await?;
2065                         Ok(ret0)
2066                     }
call_bool_arg<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: bool, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,2067                     pub async fn call_bool_arg<S: wasmtime::AsContextMut>(
2068                         &self,
2069                         mut store: S,
2070                         arg0: bool,
2071                     ) -> wasmtime::Result<()>
2072                     where
2073                         <S as wasmtime::AsContext>::Data: Send,
2074                     {
2075                         use tracing::Instrument;
2076                         let span = tracing::span!(
2077                             tracing::Level::TRACE, "wit-bindgen export", module =
2078                             "foo:foo/variants", function = "bool-arg",
2079                         );
2080                         let callee = unsafe {
2081                             wasmtime::component::TypedFunc::<
2082                                 (bool,),
2083                                 (),
2084                             >::new_unchecked(self.bool_arg)
2085                         };
2086                         let () = callee
2087                             .call_async(store.as_context_mut(), (arg0,))
2088                             .instrument(span.clone())
2089                             .await?;
2090                         Ok(())
2091                     }
call_bool_result<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<bool> where <S as wasmtime::AsContext>::Data: Send,2092                     pub async fn call_bool_result<S: wasmtime::AsContextMut>(
2093                         &self,
2094                         mut store: S,
2095                     ) -> wasmtime::Result<bool>
2096                     where
2097                         <S as wasmtime::AsContext>::Data: Send,
2098                     {
2099                         use tracing::Instrument;
2100                         let span = tracing::span!(
2101                             tracing::Level::TRACE, "wit-bindgen export", module =
2102                             "foo:foo/variants", function = "bool-result",
2103                         );
2104                         let callee = unsafe {
2105                             wasmtime::component::TypedFunc::<
2106                                 (),
2107                                 (bool,),
2108                             >::new_unchecked(self.bool_result)
2109                         };
2110                         let (ret0,) = callee
2111                             .call_async(store.as_context_mut(), ())
2112                             .instrument(span.clone())
2113                             .await?;
2114                         Ok(ret0)
2115                     }
call_option_arg<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: Option<bool>, arg1: Option<()>, arg2: Option<u32>, arg3: Option<E1>, arg4: Option<f32>, arg5: Option<Option<bool>>, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,2116                     pub async fn call_option_arg<S: wasmtime::AsContextMut>(
2117                         &self,
2118                         mut store: S,
2119                         arg0: Option<bool>,
2120                         arg1: Option<()>,
2121                         arg2: Option<u32>,
2122                         arg3: Option<E1>,
2123                         arg4: Option<f32>,
2124                         arg5: Option<Option<bool>>,
2125                     ) -> wasmtime::Result<()>
2126                     where
2127                         <S as wasmtime::AsContext>::Data: Send,
2128                     {
2129                         use tracing::Instrument;
2130                         let span = tracing::span!(
2131                             tracing::Level::TRACE, "wit-bindgen export", module =
2132                             "foo:foo/variants", function = "option-arg",
2133                         );
2134                         let callee = unsafe {
2135                             wasmtime::component::TypedFunc::<
2136                                 (
2137                                     Option<bool>,
2138                                     Option<()>,
2139                                     Option<u32>,
2140                                     Option<E1>,
2141                                     Option<f32>,
2142                                     Option<Option<bool>>,
2143                                 ),
2144                                 (),
2145                             >::new_unchecked(self.option_arg)
2146                         };
2147                         let () = callee
2148                             .call_async(
2149                                 store.as_context_mut(),
2150                                 (arg0, arg1, arg2, arg3, arg4, arg5),
2151                             )
2152                             .instrument(span.clone())
2153                             .await?;
2154                         Ok(())
2155                     }
call_option_result<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result< ( Option<bool>, Option<()>, Option<u32>, Option<E1>, Option<f32>, Option<Option<bool>>, ), > where <S as wasmtime::AsContext>::Data: Send,2156                     pub async fn call_option_result<S: wasmtime::AsContextMut>(
2157                         &self,
2158                         mut store: S,
2159                     ) -> wasmtime::Result<
2160                         (
2161                             Option<bool>,
2162                             Option<()>,
2163                             Option<u32>,
2164                             Option<E1>,
2165                             Option<f32>,
2166                             Option<Option<bool>>,
2167                         ),
2168                     >
2169                     where
2170                         <S as wasmtime::AsContext>::Data: Send,
2171                     {
2172                         use tracing::Instrument;
2173                         let span = tracing::span!(
2174                             tracing::Level::TRACE, "wit-bindgen export", module =
2175                             "foo:foo/variants", function = "option-result",
2176                         );
2177                         let callee = unsafe {
2178                             wasmtime::component::TypedFunc::<
2179                                 (),
2180                                 (
2181                                     (
2182                                         Option<bool>,
2183                                         Option<()>,
2184                                         Option<u32>,
2185                                         Option<E1>,
2186                                         Option<f32>,
2187                                         Option<Option<bool>>,
2188                                     ),
2189                                 ),
2190                             >::new_unchecked(self.option_result)
2191                         };
2192                         let (ret0,) = callee
2193                             .call_async(store.as_context_mut(), ())
2194                             .instrument(span.clone())
2195                             .await?;
2196                         Ok(ret0)
2197                     }
call_casts<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: Casts1, arg1: Casts2, arg2: Casts3, arg3: Casts4, arg4: Casts5, arg5: Casts6, ) -> wasmtime::Result< (Casts1, Casts2, Casts3, Casts4, Casts5, Casts6), > where <S as wasmtime::AsContext>::Data: Send,2198                     pub async fn call_casts<S: wasmtime::AsContextMut>(
2199                         &self,
2200                         mut store: S,
2201                         arg0: Casts1,
2202                         arg1: Casts2,
2203                         arg2: Casts3,
2204                         arg3: Casts4,
2205                         arg4: Casts5,
2206                         arg5: Casts6,
2207                     ) -> wasmtime::Result<
2208                         (Casts1, Casts2, Casts3, Casts4, Casts5, Casts6),
2209                     >
2210                     where
2211                         <S as wasmtime::AsContext>::Data: Send,
2212                     {
2213                         use tracing::Instrument;
2214                         let span = tracing::span!(
2215                             tracing::Level::TRACE, "wit-bindgen export", module =
2216                             "foo:foo/variants", function = "casts",
2217                         );
2218                         let callee = unsafe {
2219                             wasmtime::component::TypedFunc::<
2220                                 (Casts1, Casts2, Casts3, Casts4, Casts5, Casts6),
2221                                 ((Casts1, Casts2, Casts3, Casts4, Casts5, Casts6),),
2222                             >::new_unchecked(self.casts)
2223                         };
2224                         let (ret0,) = callee
2225                             .call_async(
2226                                 store.as_context_mut(),
2227                                 (arg0, arg1, arg2, arg3, arg4, arg5),
2228                             )
2229                             .instrument(span.clone())
2230                             .await?;
2231                         Ok(ret0)
2232                     }
call_result_arg<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: Result<(), ()>, arg1: Result<(), E1>, arg2: Result<E1, ()>, arg3: Result<(), ()>, arg4: Result<u32, &V1>, arg5: Result<&str, &[u8]>, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,2233                     pub async fn call_result_arg<S: wasmtime::AsContextMut>(
2234                         &self,
2235                         mut store: S,
2236                         arg0: Result<(), ()>,
2237                         arg1: Result<(), E1>,
2238                         arg2: Result<E1, ()>,
2239                         arg3: Result<(), ()>,
2240                         arg4: Result<u32, &V1>,
2241                         arg5: Result<&str, &[u8]>,
2242                     ) -> wasmtime::Result<()>
2243                     where
2244                         <S as wasmtime::AsContext>::Data: Send,
2245                     {
2246                         use tracing::Instrument;
2247                         let span = tracing::span!(
2248                             tracing::Level::TRACE, "wit-bindgen export", module =
2249                             "foo:foo/variants", function = "result-arg",
2250                         );
2251                         let callee = unsafe {
2252                             wasmtime::component::TypedFunc::<
2253                                 (
2254                                     Result<(), ()>,
2255                                     Result<(), E1>,
2256                                     Result<E1, ()>,
2257                                     Result<(), ()>,
2258                                     Result<u32, &V1>,
2259                                     Result<&str, &[u8]>,
2260                                 ),
2261                                 (),
2262                             >::new_unchecked(self.result_arg)
2263                         };
2264                         let () = callee
2265                             .call_async(
2266                                 store.as_context_mut(),
2267                                 (arg0, arg1, arg2, arg3, arg4, arg5),
2268                             )
2269                             .instrument(span.clone())
2270                             .await?;
2271                         Ok(())
2272                     }
call_result_result<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result< ( Result<(), ()>, Result<(), E1>, Result<E1, ()>, Result<(), ()>, Result<u32, V1>, Result< wasmtime::component::__internal::String, wasmtime::component::__internal::Vec<u8>, >, ), > where <S as wasmtime::AsContext>::Data: Send,2273                     pub async fn call_result_result<S: wasmtime::AsContextMut>(
2274                         &self,
2275                         mut store: S,
2276                     ) -> wasmtime::Result<
2277                         (
2278                             Result<(), ()>,
2279                             Result<(), E1>,
2280                             Result<E1, ()>,
2281                             Result<(), ()>,
2282                             Result<u32, V1>,
2283                             Result<
2284                                 wasmtime::component::__internal::String,
2285                                 wasmtime::component::__internal::Vec<u8>,
2286                             >,
2287                         ),
2288                     >
2289                     where
2290                         <S as wasmtime::AsContext>::Data: Send,
2291                     {
2292                         use tracing::Instrument;
2293                         let span = tracing::span!(
2294                             tracing::Level::TRACE, "wit-bindgen export", module =
2295                             "foo:foo/variants", function = "result-result",
2296                         );
2297                         let callee = unsafe {
2298                             wasmtime::component::TypedFunc::<
2299                                 (),
2300                                 (
2301                                     (
2302                                         Result<(), ()>,
2303                                         Result<(), E1>,
2304                                         Result<E1, ()>,
2305                                         Result<(), ()>,
2306                                         Result<u32, V1>,
2307                                         Result<
2308                                             wasmtime::component::__internal::String,
2309                                             wasmtime::component::__internal::Vec<u8>,
2310                                         >,
2311                                     ),
2312                                 ),
2313                             >::new_unchecked(self.result_result)
2314                         };
2315                         let (ret0,) = callee
2316                             .call_async(store.as_context_mut(), ())
2317                             .instrument(span.clone())
2318                             .await?;
2319                         Ok(ret0)
2320                     }
call_return_result_sugar<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<Result<i32, MyErrno>> where <S as wasmtime::AsContext>::Data: Send,2321                     pub async fn call_return_result_sugar<S: wasmtime::AsContextMut>(
2322                         &self,
2323                         mut store: S,
2324                     ) -> wasmtime::Result<Result<i32, MyErrno>>
2325                     where
2326                         <S as wasmtime::AsContext>::Data: Send,
2327                     {
2328                         use tracing::Instrument;
2329                         let span = tracing::span!(
2330                             tracing::Level::TRACE, "wit-bindgen export", module =
2331                             "foo:foo/variants", function = "return-result-sugar",
2332                         );
2333                         let callee = unsafe {
2334                             wasmtime::component::TypedFunc::<
2335                                 (),
2336                                 (Result<i32, MyErrno>,),
2337                             >::new_unchecked(self.return_result_sugar)
2338                         };
2339                         let (ret0,) = callee
2340                             .call_async(store.as_context_mut(), ())
2341                             .instrument(span.clone())
2342                             .await?;
2343                         Ok(ret0)
2344                     }
call_return_result_sugar2<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<Result<(), MyErrno>> where <S as wasmtime::AsContext>::Data: Send,2345                     pub async fn call_return_result_sugar2<S: wasmtime::AsContextMut>(
2346                         &self,
2347                         mut store: S,
2348                     ) -> wasmtime::Result<Result<(), MyErrno>>
2349                     where
2350                         <S as wasmtime::AsContext>::Data: Send,
2351                     {
2352                         use tracing::Instrument;
2353                         let span = tracing::span!(
2354                             tracing::Level::TRACE, "wit-bindgen export", module =
2355                             "foo:foo/variants", function = "return-result-sugar2",
2356                         );
2357                         let callee = unsafe {
2358                             wasmtime::component::TypedFunc::<
2359                                 (),
2360                                 (Result<(), MyErrno>,),
2361                             >::new_unchecked(self.return_result_sugar2)
2362                         };
2363                         let (ret0,) = callee
2364                             .call_async(store.as_context_mut(), ())
2365                             .instrument(span.clone())
2366                             .await?;
2367                         Ok(ret0)
2368                     }
call_return_result_sugar3<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<Result<MyErrno, MyErrno>> where <S as wasmtime::AsContext>::Data: Send,2369                     pub async fn call_return_result_sugar3<S: wasmtime::AsContextMut>(
2370                         &self,
2371                         mut store: S,
2372                     ) -> wasmtime::Result<Result<MyErrno, MyErrno>>
2373                     where
2374                         <S as wasmtime::AsContext>::Data: Send,
2375                     {
2376                         use tracing::Instrument;
2377                         let span = tracing::span!(
2378                             tracing::Level::TRACE, "wit-bindgen export", module =
2379                             "foo:foo/variants", function = "return-result-sugar3",
2380                         );
2381                         let callee = unsafe {
2382                             wasmtime::component::TypedFunc::<
2383                                 (),
2384                                 (Result<MyErrno, MyErrno>,),
2385                             >::new_unchecked(self.return_result_sugar3)
2386                         };
2387                         let (ret0,) = callee
2388                             .call_async(store.as_context_mut(), ())
2389                             .instrument(span.clone())
2390                             .await?;
2391                         Ok(ret0)
2392                     }
call_return_result_sugar4<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<Result<(i32, u32), MyErrno>> where <S as wasmtime::AsContext>::Data: Send,2393                     pub async fn call_return_result_sugar4<S: wasmtime::AsContextMut>(
2394                         &self,
2395                         mut store: S,
2396                     ) -> wasmtime::Result<Result<(i32, u32), MyErrno>>
2397                     where
2398                         <S as wasmtime::AsContext>::Data: Send,
2399                     {
2400                         use tracing::Instrument;
2401                         let span = tracing::span!(
2402                             tracing::Level::TRACE, "wit-bindgen export", module =
2403                             "foo:foo/variants", function = "return-result-sugar4",
2404                         );
2405                         let callee = unsafe {
2406                             wasmtime::component::TypedFunc::<
2407                                 (),
2408                                 (Result<(i32, u32), MyErrno>,),
2409                             >::new_unchecked(self.return_result_sugar4)
2410                         };
2411                         let (ret0,) = callee
2412                             .call_async(store.as_context_mut(), ())
2413                             .instrument(span.clone())
2414                             .await?;
2415                         Ok(ret0)
2416                     }
call_return_option_sugar<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<Option<i32>> where <S as wasmtime::AsContext>::Data: Send,2417                     pub async fn call_return_option_sugar<S: wasmtime::AsContextMut>(
2418                         &self,
2419                         mut store: S,
2420                     ) -> wasmtime::Result<Option<i32>>
2421                     where
2422                         <S as wasmtime::AsContext>::Data: Send,
2423                     {
2424                         use tracing::Instrument;
2425                         let span = tracing::span!(
2426                             tracing::Level::TRACE, "wit-bindgen export", module =
2427                             "foo:foo/variants", function = "return-option-sugar",
2428                         );
2429                         let callee = unsafe {
2430                             wasmtime::component::TypedFunc::<
2431                                 (),
2432                                 (Option<i32>,),
2433                             >::new_unchecked(self.return_option_sugar)
2434                         };
2435                         let (ret0,) = callee
2436                             .call_async(store.as_context_mut(), ())
2437                             .instrument(span.clone())
2438                             .await?;
2439                         Ok(ret0)
2440                     }
call_return_option_sugar2<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<Option<MyErrno>> where <S as wasmtime::AsContext>::Data: Send,2441                     pub async fn call_return_option_sugar2<S: wasmtime::AsContextMut>(
2442                         &self,
2443                         mut store: S,
2444                     ) -> wasmtime::Result<Option<MyErrno>>
2445                     where
2446                         <S as wasmtime::AsContext>::Data: Send,
2447                     {
2448                         use tracing::Instrument;
2449                         let span = tracing::span!(
2450                             tracing::Level::TRACE, "wit-bindgen export", module =
2451                             "foo:foo/variants", function = "return-option-sugar2",
2452                         );
2453                         let callee = unsafe {
2454                             wasmtime::component::TypedFunc::<
2455                                 (),
2456                                 (Option<MyErrno>,),
2457                             >::new_unchecked(self.return_option_sugar2)
2458                         };
2459                         let (ret0,) = callee
2460                             .call_async(store.as_context_mut(), ())
2461                             .instrument(span.clone())
2462                             .await?;
2463                         Ok(ret0)
2464                     }
call_result_simple<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<Result<u32, i32>> where <S as wasmtime::AsContext>::Data: Send,2465                     pub async fn call_result_simple<S: wasmtime::AsContextMut>(
2466                         &self,
2467                         mut store: S,
2468                     ) -> wasmtime::Result<Result<u32, i32>>
2469                     where
2470                         <S as wasmtime::AsContext>::Data: Send,
2471                     {
2472                         use tracing::Instrument;
2473                         let span = tracing::span!(
2474                             tracing::Level::TRACE, "wit-bindgen export", module =
2475                             "foo:foo/variants", function = "result-simple",
2476                         );
2477                         let callee = unsafe {
2478                             wasmtime::component::TypedFunc::<
2479                                 (),
2480                                 (Result<u32, i32>,),
2481                             >::new_unchecked(self.result_simple)
2482                         };
2483                         let (ret0,) = callee
2484                             .call_async(store.as_context_mut(), ())
2485                             .instrument(span.clone())
2486                             .await?;
2487                         Ok(ret0)
2488                     }
call_is_clone_arg<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: &IsClone, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,2489                     pub async fn call_is_clone_arg<S: wasmtime::AsContextMut>(
2490                         &self,
2491                         mut store: S,
2492                         arg0: &IsClone,
2493                     ) -> wasmtime::Result<()>
2494                     where
2495                         <S as wasmtime::AsContext>::Data: Send,
2496                     {
2497                         use tracing::Instrument;
2498                         let span = tracing::span!(
2499                             tracing::Level::TRACE, "wit-bindgen export", module =
2500                             "foo:foo/variants", function = "is-clone-arg",
2501                         );
2502                         let callee = unsafe {
2503                             wasmtime::component::TypedFunc::<
2504                                 (&IsClone,),
2505                                 (),
2506                             >::new_unchecked(self.is_clone_arg)
2507                         };
2508                         let () = callee
2509                             .call_async(store.as_context_mut(), (arg0,))
2510                             .instrument(span.clone())
2511                             .await?;
2512                         Ok(())
2513                     }
call_is_clone_return<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<IsClone> where <S as wasmtime::AsContext>::Data: Send,2514                     pub async fn call_is_clone_return<S: wasmtime::AsContextMut>(
2515                         &self,
2516                         mut store: S,
2517                     ) -> wasmtime::Result<IsClone>
2518                     where
2519                         <S as wasmtime::AsContext>::Data: Send,
2520                     {
2521                         use tracing::Instrument;
2522                         let span = tracing::span!(
2523                             tracing::Level::TRACE, "wit-bindgen export", module =
2524                             "foo:foo/variants", function = "is-clone-return",
2525                         );
2526                         let callee = unsafe {
2527                             wasmtime::component::TypedFunc::<
2528                                 (),
2529                                 (IsClone,),
2530                             >::new_unchecked(self.is_clone_return)
2531                         };
2532                         let (ret0,) = callee
2533                             .call_async(store.as_context_mut(), ())
2534                             .instrument(span.clone())
2535                             .await?;
2536                         Ok(ret0)
2537                     }
2538                 }
2539             }
2540         }
2541     }
2542 }
2543