1 /// Auto-generated bindings for a pre-instantiated version of a
2 /// component which implements the world `the-world`.
3 ///
4 /// This structure is created through [`TheWorldPre::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 [`TheWorld`] as well.
9 pub struct TheWorldPre<T: 'static> {
10     instance_pre: wasmtime::component::InstancePre<T>,
11     indices: TheWorldIndices,
12 }
13 impl<T: 'static> Clone for TheWorldPre<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> TheWorldPre<_T> {
22     /// Creates a new copy of `TheWorldPre` 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 = TheWorldIndices::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 [`TheWorld`] 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<TheWorld>46     pub fn instantiate(
47         &self,
48         mut store: impl wasmtime::AsContextMut<Data = _T>,
49     ) -> wasmtime::Result<TheWorld> {
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> TheWorldPre<_T> {
56     /// Same as [`Self::instantiate`], except with `async`.
instantiate_async( &self, mut store: impl wasmtime::AsContextMut<Data = _T>, ) -> wasmtime::Result<TheWorld>57     pub async fn instantiate_async(
58         &self,
59         mut store: impl wasmtime::AsContextMut<Data = _T>,
60     ) -> wasmtime::Result<TheWorld> {
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 /// `the-world`.
68 ///
69 /// This is an implementation detail of [`TheWorldPre`] and can
70 /// be constructed if needed as well.
71 ///
72 /// For more information see [`TheWorld`] as well.
73 #[derive(Clone)]
74 pub struct TheWorldIndices {
75     interface0: exports::foo::foo::integers::GuestIndices,
76 }
77 /// Auto-generated bindings for an instance a component which
78 /// implements the world `the-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 ///   [`TheWorld::instantiate`] which only needs a
85 ///   [`Store`], [`Component`], and [`Linker`].
86 ///
87 /// * Alternatively you can create a [`TheWorldPre`] 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 [`TheWorldPre::instantiate`] to
91 ///   create a [`TheWorld`].
92 ///
93 /// * If you've instantiated the instance yourself already
94 ///   then you can use [`TheWorld::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 TheWorld {
103     interface0: exports::foo::foo::integers::Guest,
104 }
105 const _: () = {
106     impl TheWorldIndices {
107         /// Creates a new copy of `TheWorldIndices` 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::integers::GuestIndices::new(
118                 _instance_pre,
119             )?;
120             Ok(TheWorldIndices { interface0 })
121         }
122         /// Uses the indices stored in `self` to load an instance
123         /// of [`TheWorld`] 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<TheWorld>127         pub fn load(
128             &self,
129             mut store: impl wasmtime::AsContextMut,
130             instance: &wasmtime::component::Instance,
131         ) -> wasmtime::Result<TheWorld> {
132             let _ = &mut store;
133             let _instance = instance;
134             let interface0 = self.interface0.load(&mut store, &_instance)?;
135             Ok(TheWorld { interface0 })
136         }
137     }
138     impl TheWorld {
139         /// Convenience wrapper around [`TheWorldPre::new`] and
140         /// [`TheWorldPre::instantiate`].
instantiate<_T>( store: impl wasmtime::AsContextMut<Data = _T>, component: &wasmtime::component::Component, linker: &wasmtime::component::Linker<_T>, ) -> wasmtime::Result<TheWorld>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<TheWorld> {
146             let pre = linker.instantiate_pre(component)?;
147             TheWorldPre::new(pre)?.instantiate(store)
148         }
149         /// Convenience wrapper around [`TheWorldIndices::new`] and
150         /// [`TheWorldIndices::load`].
new( mut store: impl wasmtime::AsContextMut, instance: &wasmtime::component::Instance, ) -> wasmtime::Result<TheWorld>151         pub fn new(
152             mut store: impl wasmtime::AsContextMut,
153             instance: &wasmtime::component::Instance,
154         ) -> wasmtime::Result<TheWorld> {
155             let indices = TheWorldIndices::new(&instance.instance_pre(&store))?;
156             indices.load(&mut store, instance)
157         }
158         /// Convenience wrapper around [`TheWorldPre::new`] and
159         /// [`TheWorldPre::instantiate_async`].
instantiate_async<_T>( store: impl wasmtime::AsContextMut<Data = _T>, component: &wasmtime::component::Component, linker: &wasmtime::component::Linker<_T>, ) -> wasmtime::Result<TheWorld> 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<TheWorld>
165         where
166             _T: Send,
167         {
168             let pre = linker.instantiate_pre(component)?;
169             TheWorldPre::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::integers::HostWithStore + Send, for<'a> D::Data<'a>: foo::foo::integers::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::integers::HostWithStore + Send,
177             for<'a> D::Data<'a>: foo::foo::integers::Host + Send,
178             T: 'static + Send,
179         {
180             foo::foo::integers::add_to_linker::<T, D>(linker, host_getter)?;
181             Ok(())
182         }
foo_foo_integers(&self) -> &exports::foo::foo::integers::Guest183         pub fn foo_foo_integers(&self) -> &exports::foo::foo::integers::Guest {
184             &self.interface0
185         }
186     }
187 };
188 pub mod foo {
189     pub mod foo {
190         #[allow(clippy::all)]
191         pub mod integers {
192             #[allow(unused_imports)]
193             use wasmtime::component::__internal::Box;
194             pub trait HostWithStore: wasmtime::component::HasData + Send {}
195             impl<_T: ?Sized> HostWithStore for _T
196             where
197                 _T: wasmtime::component::HasData + Send,
198             {}
199             pub trait Host: Send {
a1( &mut self, x: u8, ) -> impl ::core::future::Future<Output = ()> + Send200                 fn a1(
201                     &mut self,
202                     x: u8,
203                 ) -> impl ::core::future::Future<Output = ()> + Send;
a2( &mut self, x: i8, ) -> impl ::core::future::Future<Output = ()> + Send204                 fn a2(
205                     &mut self,
206                     x: i8,
207                 ) -> impl ::core::future::Future<Output = ()> + Send;
a3( &mut self, x: u16, ) -> impl ::core::future::Future<Output = ()> + Send208                 fn a3(
209                     &mut self,
210                     x: u16,
211                 ) -> impl ::core::future::Future<Output = ()> + Send;
a4( &mut self, x: i16, ) -> impl ::core::future::Future<Output = ()> + Send212                 fn a4(
213                     &mut self,
214                     x: i16,
215                 ) -> impl ::core::future::Future<Output = ()> + Send;
a5( &mut self, x: u32, ) -> impl ::core::future::Future<Output = ()> + Send216                 fn a5(
217                     &mut self,
218                     x: u32,
219                 ) -> impl ::core::future::Future<Output = ()> + Send;
a6( &mut self, x: i32, ) -> impl ::core::future::Future<Output = ()> + Send220                 fn a6(
221                     &mut self,
222                     x: i32,
223                 ) -> impl ::core::future::Future<Output = ()> + Send;
a7( &mut self, x: u64, ) -> impl ::core::future::Future<Output = ()> + Send224                 fn a7(
225                     &mut self,
226                     x: u64,
227                 ) -> impl ::core::future::Future<Output = ()> + Send;
a8( &mut self, x: i64, ) -> impl ::core::future::Future<Output = ()> + Send228                 fn a8(
229                     &mut self,
230                     x: i64,
231                 ) -> impl ::core::future::Future<Output = ()> + Send;
a9( &mut self, p1: u8, p2: i8, p3: u16, p4: i16, p5: u32, p6: i32, p7: u64, p8: i64, ) -> impl ::core::future::Future<Output = ()> + Send232                 fn a9(
233                     &mut self,
234                     p1: u8,
235                     p2: i8,
236                     p3: u16,
237                     p4: i16,
238                     p5: u32,
239                     p6: i32,
240                     p7: u64,
241                     p8: i64,
242                 ) -> impl ::core::future::Future<Output = ()> + Send;
r1(&mut self) -> impl ::core::future::Future<Output = u8> + Send243                 fn r1(&mut self) -> impl ::core::future::Future<Output = u8> + Send;
r2(&mut self) -> impl ::core::future::Future<Output = i8> + Send244                 fn r2(&mut self) -> impl ::core::future::Future<Output = i8> + Send;
r3(&mut self) -> impl ::core::future::Future<Output = u16> + Send245                 fn r3(&mut self) -> impl ::core::future::Future<Output = u16> + Send;
r4(&mut self) -> impl ::core::future::Future<Output = i16> + Send246                 fn r4(&mut self) -> impl ::core::future::Future<Output = i16> + Send;
r5(&mut self) -> impl ::core::future::Future<Output = u32> + Send247                 fn r5(&mut self) -> impl ::core::future::Future<Output = u32> + Send;
r6(&mut self) -> impl ::core::future::Future<Output = i32> + Send248                 fn r6(&mut self) -> impl ::core::future::Future<Output = i32> + Send;
r7(&mut self) -> impl ::core::future::Future<Output = u64> + Send249                 fn r7(&mut self) -> impl ::core::future::Future<Output = u64> + Send;
r8(&mut self) -> impl ::core::future::Future<Output = i64> + Send250                 fn r8(&mut self) -> impl ::core::future::Future<Output = i64> + Send;
pair_ret( &mut self, ) -> impl ::core::future::Future<Output = (i64, u8)> + Send251                 fn pair_ret(
252                     &mut self,
253                 ) -> impl ::core::future::Future<Output = (i64, u8)> + Send;
254             }
255             impl<_T: Host + ?Sized + Send> Host for &mut _T {
a1( &mut self, x: u8, ) -> impl ::core::future::Future<Output = ()> + Send256                 fn a1(
257                     &mut self,
258                     x: u8,
259                 ) -> impl ::core::future::Future<Output = ()> + Send {
260                     async move { Host::a1(*self, x).await }
261                 }
a2( &mut self, x: i8, ) -> impl ::core::future::Future<Output = ()> + Send262                 fn a2(
263                     &mut self,
264                     x: i8,
265                 ) -> impl ::core::future::Future<Output = ()> + Send {
266                     async move { Host::a2(*self, x).await }
267                 }
a3( &mut self, x: u16, ) -> impl ::core::future::Future<Output = ()> + Send268                 fn a3(
269                     &mut self,
270                     x: u16,
271                 ) -> impl ::core::future::Future<Output = ()> + Send {
272                     async move { Host::a3(*self, x).await }
273                 }
a4( &mut self, x: i16, ) -> impl ::core::future::Future<Output = ()> + Send274                 fn a4(
275                     &mut self,
276                     x: i16,
277                 ) -> impl ::core::future::Future<Output = ()> + Send {
278                     async move { Host::a4(*self, x).await }
279                 }
a5( &mut self, x: u32, ) -> impl ::core::future::Future<Output = ()> + Send280                 fn a5(
281                     &mut self,
282                     x: u32,
283                 ) -> impl ::core::future::Future<Output = ()> + Send {
284                     async move { Host::a5(*self, x).await }
285                 }
a6( &mut self, x: i32, ) -> impl ::core::future::Future<Output = ()> + Send286                 fn a6(
287                     &mut self,
288                     x: i32,
289                 ) -> impl ::core::future::Future<Output = ()> + Send {
290                     async move { Host::a6(*self, x).await }
291                 }
a7( &mut self, x: u64, ) -> impl ::core::future::Future<Output = ()> + Send292                 fn a7(
293                     &mut self,
294                     x: u64,
295                 ) -> impl ::core::future::Future<Output = ()> + Send {
296                     async move { Host::a7(*self, x).await }
297                 }
a8( &mut self, x: i64, ) -> impl ::core::future::Future<Output = ()> + Send298                 fn a8(
299                     &mut self,
300                     x: i64,
301                 ) -> impl ::core::future::Future<Output = ()> + Send {
302                     async move { Host::a8(*self, x).await }
303                 }
a9( &mut self, p1: u8, p2: i8, p3: u16, p4: i16, p5: u32, p6: i32, p7: u64, p8: i64, ) -> impl ::core::future::Future<Output = ()> + Send304                 fn a9(
305                     &mut self,
306                     p1: u8,
307                     p2: i8,
308                     p3: u16,
309                     p4: i16,
310                     p5: u32,
311                     p6: i32,
312                     p7: u64,
313                     p8: i64,
314                 ) -> impl ::core::future::Future<Output = ()> + Send {
315                     async move { Host::a9(*self, p1, p2, p3, p4, p5, p6, p7, p8).await }
316                 }
r1(&mut self) -> impl ::core::future::Future<Output = u8> + Send317                 fn r1(&mut self) -> impl ::core::future::Future<Output = u8> + Send {
318                     async move { Host::r1(*self).await }
319                 }
r2(&mut self) -> impl ::core::future::Future<Output = i8> + Send320                 fn r2(&mut self) -> impl ::core::future::Future<Output = i8> + Send {
321                     async move { Host::r2(*self).await }
322                 }
r3(&mut self) -> impl ::core::future::Future<Output = u16> + Send323                 fn r3(&mut self) -> impl ::core::future::Future<Output = u16> + Send {
324                     async move { Host::r3(*self).await }
325                 }
r4(&mut self) -> impl ::core::future::Future<Output = i16> + Send326                 fn r4(&mut self) -> impl ::core::future::Future<Output = i16> + Send {
327                     async move { Host::r4(*self).await }
328                 }
r5(&mut self) -> impl ::core::future::Future<Output = u32> + Send329                 fn r5(&mut self) -> impl ::core::future::Future<Output = u32> + Send {
330                     async move { Host::r5(*self).await }
331                 }
r6(&mut self) -> impl ::core::future::Future<Output = i32> + Send332                 fn r6(&mut self) -> impl ::core::future::Future<Output = i32> + Send {
333                     async move { Host::r6(*self).await }
334                 }
r7(&mut self) -> impl ::core::future::Future<Output = u64> + Send335                 fn r7(&mut self) -> impl ::core::future::Future<Output = u64> + Send {
336                     async move { Host::r7(*self).await }
337                 }
r8(&mut self) -> impl ::core::future::Future<Output = i64> + Send338                 fn r8(&mut self) -> impl ::core::future::Future<Output = i64> + Send {
339                     async move { Host::r8(*self).await }
340                 }
pair_ret( &mut self, ) -> impl ::core::future::Future<Output = (i64, u8)> + Send341                 fn pair_ret(
342                     &mut self,
343                 ) -> impl ::core::future::Future<Output = (i64, u8)> + Send {
344                     async move { Host::pair_ret(*self).await }
345                 }
346             }
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,347             pub fn add_to_linker<T, D>(
348                 linker: &mut wasmtime::component::Linker<T>,
349                 host_getter: fn(&mut T) -> D::Data<'_>,
350             ) -> wasmtime::Result<()>
351             where
352                 D: HostWithStore,
353                 for<'a> D::Data<'a>: Host,
354                 T: 'static + Send,
355             {
356                 let mut inst = linker.instance("foo:foo/integers")?;
357                 inst.func_wrap_async(
358                     "a1",
359                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (u8,)| {
360                         wasmtime::component::__internal::Box::new(async move {
361                             let host = &mut host_getter(caller.data_mut());
362                             let r = Host::a1(host, arg0).await;
363                             Ok(r)
364                         })
365                     },
366                 )?;
367                 inst.func_wrap_async(
368                     "a2",
369                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (i8,)| {
370                         wasmtime::component::__internal::Box::new(async move {
371                             let host = &mut host_getter(caller.data_mut());
372                             let r = Host::a2(host, arg0).await;
373                             Ok(r)
374                         })
375                     },
376                 )?;
377                 inst.func_wrap_async(
378                     "a3",
379                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (u16,)| {
380                         wasmtime::component::__internal::Box::new(async move {
381                             let host = &mut host_getter(caller.data_mut());
382                             let r = Host::a3(host, arg0).await;
383                             Ok(r)
384                         })
385                     },
386                 )?;
387                 inst.func_wrap_async(
388                     "a4",
389                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (i16,)| {
390                         wasmtime::component::__internal::Box::new(async move {
391                             let host = &mut host_getter(caller.data_mut());
392                             let r = Host::a4(host, arg0).await;
393                             Ok(r)
394                         })
395                     },
396                 )?;
397                 inst.func_wrap_async(
398                     "a5",
399                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (u32,)| {
400                         wasmtime::component::__internal::Box::new(async move {
401                             let host = &mut host_getter(caller.data_mut());
402                             let r = Host::a5(host, arg0).await;
403                             Ok(r)
404                         })
405                     },
406                 )?;
407                 inst.func_wrap_async(
408                     "a6",
409                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (i32,)| {
410                         wasmtime::component::__internal::Box::new(async move {
411                             let host = &mut host_getter(caller.data_mut());
412                             let r = Host::a6(host, arg0).await;
413                             Ok(r)
414                         })
415                     },
416                 )?;
417                 inst.func_wrap_async(
418                     "a7",
419                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (u64,)| {
420                         wasmtime::component::__internal::Box::new(async move {
421                             let host = &mut host_getter(caller.data_mut());
422                             let r = Host::a7(host, arg0).await;
423                             Ok(r)
424                         })
425                     },
426                 )?;
427                 inst.func_wrap_async(
428                     "a8",
429                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (i64,)| {
430                         wasmtime::component::__internal::Box::new(async move {
431                             let host = &mut host_getter(caller.data_mut());
432                             let r = Host::a8(host, arg0).await;
433                             Ok(r)
434                         })
435                     },
436                 )?;
437                 inst.func_wrap_async(
438                     "a9",
439                     move |
440                         mut caller: wasmtime::StoreContextMut<'_, T>,
441                         (
442                             arg0,
443                             arg1,
444                             arg2,
445                             arg3,
446                             arg4,
447                             arg5,
448                             arg6,
449                             arg7,
450                         ): (u8, i8, u16, i16, u32, i32, u64, i64)|
451                     {
452                         wasmtime::component::__internal::Box::new(async move {
453                             let host = &mut host_getter(caller.data_mut());
454                             let r = Host::a9(
455                                     host,
456                                     arg0,
457                                     arg1,
458                                     arg2,
459                                     arg3,
460                                     arg4,
461                                     arg5,
462                                     arg6,
463                                     arg7,
464                                 )
465                                 .await;
466                             Ok(r)
467                         })
468                     },
469                 )?;
470                 inst.func_wrap_async(
471                     "r1",
472                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
473                         wasmtime::component::__internal::Box::new(async move {
474                             let host = &mut host_getter(caller.data_mut());
475                             let r = Host::r1(host).await;
476                             Ok((r,))
477                         })
478                     },
479                 )?;
480                 inst.func_wrap_async(
481                     "r2",
482                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
483                         wasmtime::component::__internal::Box::new(async move {
484                             let host = &mut host_getter(caller.data_mut());
485                             let r = Host::r2(host).await;
486                             Ok((r,))
487                         })
488                     },
489                 )?;
490                 inst.func_wrap_async(
491                     "r3",
492                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
493                         wasmtime::component::__internal::Box::new(async move {
494                             let host = &mut host_getter(caller.data_mut());
495                             let r = Host::r3(host).await;
496                             Ok((r,))
497                         })
498                     },
499                 )?;
500                 inst.func_wrap_async(
501                     "r4",
502                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
503                         wasmtime::component::__internal::Box::new(async move {
504                             let host = &mut host_getter(caller.data_mut());
505                             let r = Host::r4(host).await;
506                             Ok((r,))
507                         })
508                     },
509                 )?;
510                 inst.func_wrap_async(
511                     "r5",
512                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
513                         wasmtime::component::__internal::Box::new(async move {
514                             let host = &mut host_getter(caller.data_mut());
515                             let r = Host::r5(host).await;
516                             Ok((r,))
517                         })
518                     },
519                 )?;
520                 inst.func_wrap_async(
521                     "r6",
522                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
523                         wasmtime::component::__internal::Box::new(async move {
524                             let host = &mut host_getter(caller.data_mut());
525                             let r = Host::r6(host).await;
526                             Ok((r,))
527                         })
528                     },
529                 )?;
530                 inst.func_wrap_async(
531                     "r7",
532                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
533                         wasmtime::component::__internal::Box::new(async move {
534                             let host = &mut host_getter(caller.data_mut());
535                             let r = Host::r7(host).await;
536                             Ok((r,))
537                         })
538                     },
539                 )?;
540                 inst.func_wrap_async(
541                     "r8",
542                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
543                         wasmtime::component::__internal::Box::new(async move {
544                             let host = &mut host_getter(caller.data_mut());
545                             let r = Host::r8(host).await;
546                             Ok((r,))
547                         })
548                     },
549                 )?;
550                 inst.func_wrap_async(
551                     "pair-ret",
552                     move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
553                         wasmtime::component::__internal::Box::new(async move {
554                             let host = &mut host_getter(caller.data_mut());
555                             let r = Host::pair_ret(host).await;
556                             Ok((r,))
557                         })
558                     },
559                 )?;
560                 Ok(())
561             }
562         }
563     }
564 }
565 pub mod exports {
566     pub mod foo {
567         pub mod foo {
568             #[allow(clippy::all)]
569             pub mod integers {
570                 #[allow(unused_imports)]
571                 use wasmtime::component::__internal::Box;
572                 #[derive(Clone)]
573                 pub struct Guest {
574                     a1: wasmtime::component::Func,
575                     a2: wasmtime::component::Func,
576                     a3: wasmtime::component::Func,
577                     a4: wasmtime::component::Func,
578                     a5: wasmtime::component::Func,
579                     a6: wasmtime::component::Func,
580                     a7: wasmtime::component::Func,
581                     a8: wasmtime::component::Func,
582                     a9: wasmtime::component::Func,
583                     r1: wasmtime::component::Func,
584                     r2: wasmtime::component::Func,
585                     r3: wasmtime::component::Func,
586                     r4: wasmtime::component::Func,
587                     r5: wasmtime::component::Func,
588                     r6: wasmtime::component::Func,
589                     r7: wasmtime::component::Func,
590                     r8: wasmtime::component::Func,
591                     pair_ret: wasmtime::component::Func,
592                 }
593                 #[derive(Clone)]
594                 pub struct GuestIndices {
595                     a1: wasmtime::component::ComponentExportIndex,
596                     a2: wasmtime::component::ComponentExportIndex,
597                     a3: wasmtime::component::ComponentExportIndex,
598                     a4: wasmtime::component::ComponentExportIndex,
599                     a5: wasmtime::component::ComponentExportIndex,
600                     a6: wasmtime::component::ComponentExportIndex,
601                     a7: wasmtime::component::ComponentExportIndex,
602                     a8: wasmtime::component::ComponentExportIndex,
603                     a9: wasmtime::component::ComponentExportIndex,
604                     r1: wasmtime::component::ComponentExportIndex,
605                     r2: wasmtime::component::ComponentExportIndex,
606                     r3: wasmtime::component::ComponentExportIndex,
607                     r4: wasmtime::component::ComponentExportIndex,
608                     r5: wasmtime::component::ComponentExportIndex,
609                     r6: wasmtime::component::ComponentExportIndex,
610                     r7: wasmtime::component::ComponentExportIndex,
611                     r8: wasmtime::component::ComponentExportIndex,
612                     pair_ret: wasmtime::component::ComponentExportIndex,
613                 }
614                 impl GuestIndices {
615                     /// Constructor for [`GuestIndices`] which takes a
616                     /// [`Component`](wasmtime::component::Component) as input and can be executed
617                     /// before instantiation.
618                     ///
619                     /// This constructor can be used to front-load string lookups to find exports
620                     /// within a component.
new<_T>( _instance_pre: &wasmtime::component::InstancePre<_T>, ) -> wasmtime::Result<GuestIndices>621                     pub fn new<_T>(
622                         _instance_pre: &wasmtime::component::InstancePre<_T>,
623                     ) -> wasmtime::Result<GuestIndices> {
624                         let instance = _instance_pre
625                             .component()
626                             .get_export_index(None, "foo:foo/integers")
627                             .ok_or_else(|| {
628                                 wasmtime::format_err!(
629                                     "no exported instance named `foo:foo/integers`"
630                                 )
631                             })?;
632                         let mut lookup = move |name| {
633                             _instance_pre
634                                 .component()
635                                 .get_export_index(Some(&instance), name)
636                                 .ok_or_else(|| {
637                                     wasmtime::format_err!(
638                                         "instance export `foo:foo/integers` does \
639                                                     not have export `{name}`"
640                                     )
641                                 })
642                         };
643                         let _ = &mut lookup;
644                         let a1 = lookup("a1")?;
645                         let a2 = lookup("a2")?;
646                         let a3 = lookup("a3")?;
647                         let a4 = lookup("a4")?;
648                         let a5 = lookup("a5")?;
649                         let a6 = lookup("a6")?;
650                         let a7 = lookup("a7")?;
651                         let a8 = lookup("a8")?;
652                         let a9 = lookup("a9")?;
653                         let r1 = lookup("r1")?;
654                         let r2 = lookup("r2")?;
655                         let r3 = lookup("r3")?;
656                         let r4 = lookup("r4")?;
657                         let r5 = lookup("r5")?;
658                         let r6 = lookup("r6")?;
659                         let r7 = lookup("r7")?;
660                         let r8 = lookup("r8")?;
661                         let pair_ret = lookup("pair-ret")?;
662                         Ok(GuestIndices {
663                             a1,
664                             a2,
665                             a3,
666                             a4,
667                             a5,
668                             a6,
669                             a7,
670                             a8,
671                             a9,
672                             r1,
673                             r2,
674                             r3,
675                             r4,
676                             r5,
677                             r6,
678                             r7,
679                             r8,
680                             pair_ret,
681                         })
682                     }
load( &self, mut store: impl wasmtime::AsContextMut, instance: &wasmtime::component::Instance, ) -> wasmtime::Result<Guest>683                     pub fn load(
684                         &self,
685                         mut store: impl wasmtime::AsContextMut,
686                         instance: &wasmtime::component::Instance,
687                     ) -> wasmtime::Result<Guest> {
688                         let _instance = instance;
689                         let _instance_pre = _instance.instance_pre(&store);
690                         let _instance_type = _instance_pre.instance_type();
691                         let mut store = store.as_context_mut();
692                         let _ = &mut store;
693                         let a1 = *_instance
694                             .get_typed_func::<(u8,), ()>(&mut store, &self.a1)?
695                             .func();
696                         let a2 = *_instance
697                             .get_typed_func::<(i8,), ()>(&mut store, &self.a2)?
698                             .func();
699                         let a3 = *_instance
700                             .get_typed_func::<(u16,), ()>(&mut store, &self.a3)?
701                             .func();
702                         let a4 = *_instance
703                             .get_typed_func::<(i16,), ()>(&mut store, &self.a4)?
704                             .func();
705                         let a5 = *_instance
706                             .get_typed_func::<(u32,), ()>(&mut store, &self.a5)?
707                             .func();
708                         let a6 = *_instance
709                             .get_typed_func::<(i32,), ()>(&mut store, &self.a6)?
710                             .func();
711                         let a7 = *_instance
712                             .get_typed_func::<(u64,), ()>(&mut store, &self.a7)?
713                             .func();
714                         let a8 = *_instance
715                             .get_typed_func::<(i64,), ()>(&mut store, &self.a8)?
716                             .func();
717                         let a9 = *_instance
718                             .get_typed_func::<
719                                 (u8, i8, u16, i16, u32, i32, u64, i64),
720                                 (),
721                             >(&mut store, &self.a9)?
722                             .func();
723                         let r1 = *_instance
724                             .get_typed_func::<(), (u8,)>(&mut store, &self.r1)?
725                             .func();
726                         let r2 = *_instance
727                             .get_typed_func::<(), (i8,)>(&mut store, &self.r2)?
728                             .func();
729                         let r3 = *_instance
730                             .get_typed_func::<(), (u16,)>(&mut store, &self.r3)?
731                             .func();
732                         let r4 = *_instance
733                             .get_typed_func::<(), (i16,)>(&mut store, &self.r4)?
734                             .func();
735                         let r5 = *_instance
736                             .get_typed_func::<(), (u32,)>(&mut store, &self.r5)?
737                             .func();
738                         let r6 = *_instance
739                             .get_typed_func::<(), (i32,)>(&mut store, &self.r6)?
740                             .func();
741                         let r7 = *_instance
742                             .get_typed_func::<(), (u64,)>(&mut store, &self.r7)?
743                             .func();
744                         let r8 = *_instance
745                             .get_typed_func::<(), (i64,)>(&mut store, &self.r8)?
746                             .func();
747                         let pair_ret = *_instance
748                             .get_typed_func::<
749                                 (),
750                                 ((i64, u8),),
751                             >(&mut store, &self.pair_ret)?
752                             .func();
753                         Ok(Guest {
754                             a1,
755                             a2,
756                             a3,
757                             a4,
758                             a5,
759                             a6,
760                             a7,
761                             a8,
762                             a9,
763                             r1,
764                             r2,
765                             r3,
766                             r4,
767                             r5,
768                             r6,
769                             r7,
770                             r8,
771                             pair_ret,
772                         })
773                     }
774                 }
775                 impl Guest {
call_a1<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: u8, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,776                     pub async fn call_a1<S: wasmtime::AsContextMut>(
777                         &self,
778                         mut store: S,
779                         arg0: u8,
780                     ) -> wasmtime::Result<()>
781                     where
782                         <S as wasmtime::AsContext>::Data: Send,
783                     {
784                         let callee = unsafe {
785                             wasmtime::component::TypedFunc::<
786                                 (u8,),
787                                 (),
788                             >::new_unchecked(self.a1)
789                         };
790                         let () = callee
791                             .call_async(store.as_context_mut(), (arg0,))
792                             .await?;
793                         Ok(())
794                     }
call_a2<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: i8, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,795                     pub async fn call_a2<S: wasmtime::AsContextMut>(
796                         &self,
797                         mut store: S,
798                         arg0: i8,
799                     ) -> wasmtime::Result<()>
800                     where
801                         <S as wasmtime::AsContext>::Data: Send,
802                     {
803                         let callee = unsafe {
804                             wasmtime::component::TypedFunc::<
805                                 (i8,),
806                                 (),
807                             >::new_unchecked(self.a2)
808                         };
809                         let () = callee
810                             .call_async(store.as_context_mut(), (arg0,))
811                             .await?;
812                         Ok(())
813                     }
call_a3<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: u16, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,814                     pub async fn call_a3<S: wasmtime::AsContextMut>(
815                         &self,
816                         mut store: S,
817                         arg0: u16,
818                     ) -> wasmtime::Result<()>
819                     where
820                         <S as wasmtime::AsContext>::Data: Send,
821                     {
822                         let callee = unsafe {
823                             wasmtime::component::TypedFunc::<
824                                 (u16,),
825                                 (),
826                             >::new_unchecked(self.a3)
827                         };
828                         let () = callee
829                             .call_async(store.as_context_mut(), (arg0,))
830                             .await?;
831                         Ok(())
832                     }
call_a4<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: i16, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,833                     pub async fn call_a4<S: wasmtime::AsContextMut>(
834                         &self,
835                         mut store: S,
836                         arg0: i16,
837                     ) -> wasmtime::Result<()>
838                     where
839                         <S as wasmtime::AsContext>::Data: Send,
840                     {
841                         let callee = unsafe {
842                             wasmtime::component::TypedFunc::<
843                                 (i16,),
844                                 (),
845                             >::new_unchecked(self.a4)
846                         };
847                         let () = callee
848                             .call_async(store.as_context_mut(), (arg0,))
849                             .await?;
850                         Ok(())
851                     }
call_a5<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: u32, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,852                     pub async fn call_a5<S: wasmtime::AsContextMut>(
853                         &self,
854                         mut store: S,
855                         arg0: u32,
856                     ) -> wasmtime::Result<()>
857                     where
858                         <S as wasmtime::AsContext>::Data: Send,
859                     {
860                         let callee = unsafe {
861                             wasmtime::component::TypedFunc::<
862                                 (u32,),
863                                 (),
864                             >::new_unchecked(self.a5)
865                         };
866                         let () = callee
867                             .call_async(store.as_context_mut(), (arg0,))
868                             .await?;
869                         Ok(())
870                     }
call_a6<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: i32, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,871                     pub async fn call_a6<S: wasmtime::AsContextMut>(
872                         &self,
873                         mut store: S,
874                         arg0: i32,
875                     ) -> wasmtime::Result<()>
876                     where
877                         <S as wasmtime::AsContext>::Data: Send,
878                     {
879                         let callee = unsafe {
880                             wasmtime::component::TypedFunc::<
881                                 (i32,),
882                                 (),
883                             >::new_unchecked(self.a6)
884                         };
885                         let () = callee
886                             .call_async(store.as_context_mut(), (arg0,))
887                             .await?;
888                         Ok(())
889                     }
call_a7<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: u64, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,890                     pub async fn call_a7<S: wasmtime::AsContextMut>(
891                         &self,
892                         mut store: S,
893                         arg0: u64,
894                     ) -> wasmtime::Result<()>
895                     where
896                         <S as wasmtime::AsContext>::Data: Send,
897                     {
898                         let callee = unsafe {
899                             wasmtime::component::TypedFunc::<
900                                 (u64,),
901                                 (),
902                             >::new_unchecked(self.a7)
903                         };
904                         let () = callee
905                             .call_async(store.as_context_mut(), (arg0,))
906                             .await?;
907                         Ok(())
908                     }
call_a8<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: i64, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,909                     pub async fn call_a8<S: wasmtime::AsContextMut>(
910                         &self,
911                         mut store: S,
912                         arg0: i64,
913                     ) -> wasmtime::Result<()>
914                     where
915                         <S as wasmtime::AsContext>::Data: Send,
916                     {
917                         let callee = unsafe {
918                             wasmtime::component::TypedFunc::<
919                                 (i64,),
920                                 (),
921                             >::new_unchecked(self.a8)
922                         };
923                         let () = callee
924                             .call_async(store.as_context_mut(), (arg0,))
925                             .await?;
926                         Ok(())
927                     }
call_a9<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: u8, arg1: i8, arg2: u16, arg3: i16, arg4: u32, arg5: i32, arg6: u64, arg7: i64, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,928                     pub async fn call_a9<S: wasmtime::AsContextMut>(
929                         &self,
930                         mut store: S,
931                         arg0: u8,
932                         arg1: i8,
933                         arg2: u16,
934                         arg3: i16,
935                         arg4: u32,
936                         arg5: i32,
937                         arg6: u64,
938                         arg7: i64,
939                     ) -> wasmtime::Result<()>
940                     where
941                         <S as wasmtime::AsContext>::Data: Send,
942                     {
943                         let callee = unsafe {
944                             wasmtime::component::TypedFunc::<
945                                 (u8, i8, u16, i16, u32, i32, u64, i64),
946                                 (),
947                             >::new_unchecked(self.a9)
948                         };
949                         let () = callee
950                             .call_async(
951                                 store.as_context_mut(),
952                                 (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7),
953                             )
954                             .await?;
955                         Ok(())
956                     }
call_r1<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<u8> where <S as wasmtime::AsContext>::Data: Send,957                     pub async fn call_r1<S: wasmtime::AsContextMut>(
958                         &self,
959                         mut store: S,
960                     ) -> wasmtime::Result<u8>
961                     where
962                         <S as wasmtime::AsContext>::Data: Send,
963                     {
964                         let callee = unsafe {
965                             wasmtime::component::TypedFunc::<
966                                 (),
967                                 (u8,),
968                             >::new_unchecked(self.r1)
969                         };
970                         let (ret0,) = callee
971                             .call_async(store.as_context_mut(), ())
972                             .await?;
973                         Ok(ret0)
974                     }
call_r2<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<i8> where <S as wasmtime::AsContext>::Data: Send,975                     pub async fn call_r2<S: wasmtime::AsContextMut>(
976                         &self,
977                         mut store: S,
978                     ) -> wasmtime::Result<i8>
979                     where
980                         <S as wasmtime::AsContext>::Data: Send,
981                     {
982                         let callee = unsafe {
983                             wasmtime::component::TypedFunc::<
984                                 (),
985                                 (i8,),
986                             >::new_unchecked(self.r2)
987                         };
988                         let (ret0,) = callee
989                             .call_async(store.as_context_mut(), ())
990                             .await?;
991                         Ok(ret0)
992                     }
call_r3<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<u16> where <S as wasmtime::AsContext>::Data: Send,993                     pub async fn call_r3<S: wasmtime::AsContextMut>(
994                         &self,
995                         mut store: S,
996                     ) -> wasmtime::Result<u16>
997                     where
998                         <S as wasmtime::AsContext>::Data: Send,
999                     {
1000                         let callee = unsafe {
1001                             wasmtime::component::TypedFunc::<
1002                                 (),
1003                                 (u16,),
1004                             >::new_unchecked(self.r3)
1005                         };
1006                         let (ret0,) = callee
1007                             .call_async(store.as_context_mut(), ())
1008                             .await?;
1009                         Ok(ret0)
1010                     }
call_r4<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<i16> where <S as wasmtime::AsContext>::Data: Send,1011                     pub async fn call_r4<S: wasmtime::AsContextMut>(
1012                         &self,
1013                         mut store: S,
1014                     ) -> wasmtime::Result<i16>
1015                     where
1016                         <S as wasmtime::AsContext>::Data: Send,
1017                     {
1018                         let callee = unsafe {
1019                             wasmtime::component::TypedFunc::<
1020                                 (),
1021                                 (i16,),
1022                             >::new_unchecked(self.r4)
1023                         };
1024                         let (ret0,) = callee
1025                             .call_async(store.as_context_mut(), ())
1026                             .await?;
1027                         Ok(ret0)
1028                     }
call_r5<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<u32> where <S as wasmtime::AsContext>::Data: Send,1029                     pub async fn call_r5<S: wasmtime::AsContextMut>(
1030                         &self,
1031                         mut store: S,
1032                     ) -> wasmtime::Result<u32>
1033                     where
1034                         <S as wasmtime::AsContext>::Data: Send,
1035                     {
1036                         let callee = unsafe {
1037                             wasmtime::component::TypedFunc::<
1038                                 (),
1039                                 (u32,),
1040                             >::new_unchecked(self.r5)
1041                         };
1042                         let (ret0,) = callee
1043                             .call_async(store.as_context_mut(), ())
1044                             .await?;
1045                         Ok(ret0)
1046                     }
call_r6<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<i32> where <S as wasmtime::AsContext>::Data: Send,1047                     pub async fn call_r6<S: wasmtime::AsContextMut>(
1048                         &self,
1049                         mut store: S,
1050                     ) -> wasmtime::Result<i32>
1051                     where
1052                         <S as wasmtime::AsContext>::Data: Send,
1053                     {
1054                         let callee = unsafe {
1055                             wasmtime::component::TypedFunc::<
1056                                 (),
1057                                 (i32,),
1058                             >::new_unchecked(self.r6)
1059                         };
1060                         let (ret0,) = callee
1061                             .call_async(store.as_context_mut(), ())
1062                             .await?;
1063                         Ok(ret0)
1064                     }
call_r7<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<u64> where <S as wasmtime::AsContext>::Data: Send,1065                     pub async fn call_r7<S: wasmtime::AsContextMut>(
1066                         &self,
1067                         mut store: S,
1068                     ) -> wasmtime::Result<u64>
1069                     where
1070                         <S as wasmtime::AsContext>::Data: Send,
1071                     {
1072                         let callee = unsafe {
1073                             wasmtime::component::TypedFunc::<
1074                                 (),
1075                                 (u64,),
1076                             >::new_unchecked(self.r7)
1077                         };
1078                         let (ret0,) = callee
1079                             .call_async(store.as_context_mut(), ())
1080                             .await?;
1081                         Ok(ret0)
1082                     }
call_r8<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<i64> where <S as wasmtime::AsContext>::Data: Send,1083                     pub async fn call_r8<S: wasmtime::AsContextMut>(
1084                         &self,
1085                         mut store: S,
1086                     ) -> wasmtime::Result<i64>
1087                     where
1088                         <S as wasmtime::AsContext>::Data: Send,
1089                     {
1090                         let callee = unsafe {
1091                             wasmtime::component::TypedFunc::<
1092                                 (),
1093                                 (i64,),
1094                             >::new_unchecked(self.r8)
1095                         };
1096                         let (ret0,) = callee
1097                             .call_async(store.as_context_mut(), ())
1098                             .await?;
1099                         Ok(ret0)
1100                     }
call_pair_ret<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<(i64, u8)> where <S as wasmtime::AsContext>::Data: Send,1101                     pub async fn call_pair_ret<S: wasmtime::AsContextMut>(
1102                         &self,
1103                         mut store: S,
1104                     ) -> wasmtime::Result<(i64, u8)>
1105                     where
1106                         <S as wasmtime::AsContext>::Data: Send,
1107                     {
1108                         let callee = unsafe {
1109                             wasmtime::component::TypedFunc::<
1110                                 (),
1111                                 ((i64, u8),),
1112                             >::new_unchecked(self.pair_ret)
1113                         };
1114                         let (ret0,) = callee
1115                             .call_async(store.as_context_mut(), ())
1116                             .await?;
1117                         Ok(ret0)
1118                     }
1119                 }
1120             }
1121         }
1122     }
1123 }
1124