Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/component-macro/tests/expanded/integers_tracing_async.rs
3092 views
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> {
14
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.
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
}
33
pub fn engine(&self) -> &wasmtime::Engine {
34
self.instance_pre.engine()
35
}
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.
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`.
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.
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.
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`].
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`].
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`].
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
}
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
}
183
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 {
200
fn a1(
201
&mut self,
202
x: u8,
203
) -> impl ::core::future::Future<Output = ()> + Send;
204
fn a2(
205
&mut self,
206
x: i8,
207
) -> impl ::core::future::Future<Output = ()> + Send;
208
fn a3(
209
&mut self,
210
x: u16,
211
) -> impl ::core::future::Future<Output = ()> + Send;
212
fn a4(
213
&mut self,
214
x: i16,
215
) -> impl ::core::future::Future<Output = ()> + Send;
216
fn a5(
217
&mut self,
218
x: u32,
219
) -> impl ::core::future::Future<Output = ()> + Send;
220
fn a6(
221
&mut self,
222
x: i32,
223
) -> impl ::core::future::Future<Output = ()> + Send;
224
fn a7(
225
&mut self,
226
x: u64,
227
) -> impl ::core::future::Future<Output = ()> + Send;
228
fn a8(
229
&mut self,
230
x: i64,
231
) -> impl ::core::future::Future<Output = ()> + Send;
232
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;
243
fn r1(&mut self) -> impl ::core::future::Future<Output = u8> + Send;
244
fn r2(&mut self) -> impl ::core::future::Future<Output = i8> + Send;
245
fn r3(&mut self) -> impl ::core::future::Future<Output = u16> + Send;
246
fn r4(&mut self) -> impl ::core::future::Future<Output = i16> + Send;
247
fn r5(&mut self) -> impl ::core::future::Future<Output = u32> + Send;
248
fn r6(&mut self) -> impl ::core::future::Future<Output = i32> + Send;
249
fn r7(&mut self) -> impl ::core::future::Future<Output = u64> + Send;
250
fn r8(&mut self) -> impl ::core::future::Future<Output = i64> + Send;
251
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 {
256
fn a1(
257
&mut self,
258
x: u8,
259
) -> impl ::core::future::Future<Output = ()> + Send {
260
async move { Host::a1(*self, x).await }
261
}
262
fn a2(
263
&mut self,
264
x: i8,
265
) -> impl ::core::future::Future<Output = ()> + Send {
266
async move { Host::a2(*self, x).await }
267
}
268
fn a3(
269
&mut self,
270
x: u16,
271
) -> impl ::core::future::Future<Output = ()> + Send {
272
async move { Host::a3(*self, x).await }
273
}
274
fn a4(
275
&mut self,
276
x: i16,
277
) -> impl ::core::future::Future<Output = ()> + Send {
278
async move { Host::a4(*self, x).await }
279
}
280
fn a5(
281
&mut self,
282
x: u32,
283
) -> impl ::core::future::Future<Output = ()> + Send {
284
async move { Host::a5(*self, x).await }
285
}
286
fn a6(
287
&mut self,
288
x: i32,
289
) -> impl ::core::future::Future<Output = ()> + Send {
290
async move { Host::a6(*self, x).await }
291
}
292
fn a7(
293
&mut self,
294
x: u64,
295
) -> impl ::core::future::Future<Output = ()> + Send {
296
async move { Host::a7(*self, x).await }
297
}
298
fn a8(
299
&mut self,
300
x: i64,
301
) -> impl ::core::future::Future<Output = ()> + Send {
302
async move { Host::a8(*self, x).await }
303
}
304
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
}
317
fn r1(&mut self) -> impl ::core::future::Future<Output = u8> + Send {
318
async move { Host::r1(*self).await }
319
}
320
fn r2(&mut self) -> impl ::core::future::Future<Output = i8> + Send {
321
async move { Host::r2(*self).await }
322
}
323
fn r3(&mut self) -> impl ::core::future::Future<Output = u16> + Send {
324
async move { Host::r3(*self).await }
325
}
326
fn r4(&mut self) -> impl ::core::future::Future<Output = i16> + Send {
327
async move { Host::r4(*self).await }
328
}
329
fn r5(&mut self) -> impl ::core::future::Future<Output = u32> + Send {
330
async move { Host::r5(*self).await }
331
}
332
fn r6(&mut self) -> impl ::core::future::Future<Output = i32> + Send {
333
async move { Host::r6(*self).await }
334
}
335
fn r7(&mut self) -> impl ::core::future::Future<Output = u64> + Send {
336
async move { Host::r7(*self).await }
337
}
338
fn r8(&mut self) -> impl ::core::future::Future<Output = i64> + Send {
339
async move { Host::r8(*self).await }
340
}
341
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
}
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
use tracing::Instrument;
361
let span = tracing::span!(
362
tracing::Level::TRACE, "wit-bindgen import", module =
363
"integers", function = "a1",
364
);
365
wasmtime::component::__internal::Box::new(
366
async move {
367
tracing::event!(
368
tracing::Level::TRACE, x = tracing::field::debug(& arg0),
369
"call"
370
);
371
let host = &mut host_getter(caller.data_mut());
372
let r = Host::a1(host, arg0).await;
373
tracing::event!(
374
tracing::Level::TRACE, result = tracing::field::debug(& r),
375
"return"
376
);
377
Ok(r)
378
}
379
.instrument(span),
380
)
381
},
382
)?;
383
inst.func_wrap_async(
384
"a2",
385
move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (i8,)| {
386
use tracing::Instrument;
387
let span = tracing::span!(
388
tracing::Level::TRACE, "wit-bindgen import", module =
389
"integers", function = "a2",
390
);
391
wasmtime::component::__internal::Box::new(
392
async move {
393
tracing::event!(
394
tracing::Level::TRACE, x = tracing::field::debug(& arg0),
395
"call"
396
);
397
let host = &mut host_getter(caller.data_mut());
398
let r = Host::a2(host, arg0).await;
399
tracing::event!(
400
tracing::Level::TRACE, result = tracing::field::debug(& r),
401
"return"
402
);
403
Ok(r)
404
}
405
.instrument(span),
406
)
407
},
408
)?;
409
inst.func_wrap_async(
410
"a3",
411
move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (u16,)| {
412
use tracing::Instrument;
413
let span = tracing::span!(
414
tracing::Level::TRACE, "wit-bindgen import", module =
415
"integers", function = "a3",
416
);
417
wasmtime::component::__internal::Box::new(
418
async move {
419
tracing::event!(
420
tracing::Level::TRACE, x = tracing::field::debug(& arg0),
421
"call"
422
);
423
let host = &mut host_getter(caller.data_mut());
424
let r = Host::a3(host, arg0).await;
425
tracing::event!(
426
tracing::Level::TRACE, result = tracing::field::debug(& r),
427
"return"
428
);
429
Ok(r)
430
}
431
.instrument(span),
432
)
433
},
434
)?;
435
inst.func_wrap_async(
436
"a4",
437
move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (i16,)| {
438
use tracing::Instrument;
439
let span = tracing::span!(
440
tracing::Level::TRACE, "wit-bindgen import", module =
441
"integers", function = "a4",
442
);
443
wasmtime::component::__internal::Box::new(
444
async move {
445
tracing::event!(
446
tracing::Level::TRACE, x = tracing::field::debug(& arg0),
447
"call"
448
);
449
let host = &mut host_getter(caller.data_mut());
450
let r = Host::a4(host, arg0).await;
451
tracing::event!(
452
tracing::Level::TRACE, result = tracing::field::debug(& r),
453
"return"
454
);
455
Ok(r)
456
}
457
.instrument(span),
458
)
459
},
460
)?;
461
inst.func_wrap_async(
462
"a5",
463
move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (u32,)| {
464
use tracing::Instrument;
465
let span = tracing::span!(
466
tracing::Level::TRACE, "wit-bindgen import", module =
467
"integers", function = "a5",
468
);
469
wasmtime::component::__internal::Box::new(
470
async move {
471
tracing::event!(
472
tracing::Level::TRACE, x = tracing::field::debug(& arg0),
473
"call"
474
);
475
let host = &mut host_getter(caller.data_mut());
476
let r = Host::a5(host, arg0).await;
477
tracing::event!(
478
tracing::Level::TRACE, result = tracing::field::debug(& r),
479
"return"
480
);
481
Ok(r)
482
}
483
.instrument(span),
484
)
485
},
486
)?;
487
inst.func_wrap_async(
488
"a6",
489
move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (i32,)| {
490
use tracing::Instrument;
491
let span = tracing::span!(
492
tracing::Level::TRACE, "wit-bindgen import", module =
493
"integers", function = "a6",
494
);
495
wasmtime::component::__internal::Box::new(
496
async move {
497
tracing::event!(
498
tracing::Level::TRACE, x = tracing::field::debug(& arg0),
499
"call"
500
);
501
let host = &mut host_getter(caller.data_mut());
502
let r = Host::a6(host, arg0).await;
503
tracing::event!(
504
tracing::Level::TRACE, result = tracing::field::debug(& r),
505
"return"
506
);
507
Ok(r)
508
}
509
.instrument(span),
510
)
511
},
512
)?;
513
inst.func_wrap_async(
514
"a7",
515
move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (u64,)| {
516
use tracing::Instrument;
517
let span = tracing::span!(
518
tracing::Level::TRACE, "wit-bindgen import", module =
519
"integers", function = "a7",
520
);
521
wasmtime::component::__internal::Box::new(
522
async move {
523
tracing::event!(
524
tracing::Level::TRACE, x = tracing::field::debug(& arg0),
525
"call"
526
);
527
let host = &mut host_getter(caller.data_mut());
528
let r = Host::a7(host, arg0).await;
529
tracing::event!(
530
tracing::Level::TRACE, result = tracing::field::debug(& r),
531
"return"
532
);
533
Ok(r)
534
}
535
.instrument(span),
536
)
537
},
538
)?;
539
inst.func_wrap_async(
540
"a8",
541
move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (i64,)| {
542
use tracing::Instrument;
543
let span = tracing::span!(
544
tracing::Level::TRACE, "wit-bindgen import", module =
545
"integers", function = "a8",
546
);
547
wasmtime::component::__internal::Box::new(
548
async move {
549
tracing::event!(
550
tracing::Level::TRACE, x = tracing::field::debug(& arg0),
551
"call"
552
);
553
let host = &mut host_getter(caller.data_mut());
554
let r = Host::a8(host, arg0).await;
555
tracing::event!(
556
tracing::Level::TRACE, result = tracing::field::debug(& r),
557
"return"
558
);
559
Ok(r)
560
}
561
.instrument(span),
562
)
563
},
564
)?;
565
inst.func_wrap_async(
566
"a9",
567
move |
568
mut caller: wasmtime::StoreContextMut<'_, T>,
569
(
570
arg0,
571
arg1,
572
arg2,
573
arg3,
574
arg4,
575
arg5,
576
arg6,
577
arg7,
578
): (u8, i8, u16, i16, u32, i32, u64, i64)|
579
{
580
use tracing::Instrument;
581
let span = tracing::span!(
582
tracing::Level::TRACE, "wit-bindgen import", module =
583
"integers", function = "a9",
584
);
585
wasmtime::component::__internal::Box::new(
586
async move {
587
tracing::event!(
588
tracing::Level::TRACE, p1 = tracing::field::debug(& arg0),
589
p2 = tracing::field::debug(& arg1), p3 =
590
tracing::field::debug(& arg2), p4 = tracing::field::debug(&
591
arg3), p5 = tracing::field::debug(& arg4), p6 =
592
tracing::field::debug(& arg5), p7 = tracing::field::debug(&
593
arg6), p8 = tracing::field::debug(& arg7), "call"
594
);
595
let host = &mut host_getter(caller.data_mut());
596
let r = Host::a9(
597
host,
598
arg0,
599
arg1,
600
arg2,
601
arg3,
602
arg4,
603
arg5,
604
arg6,
605
arg7,
606
)
607
.await;
608
tracing::event!(
609
tracing::Level::TRACE, result = tracing::field::debug(& r),
610
"return"
611
);
612
Ok(r)
613
}
614
.instrument(span),
615
)
616
},
617
)?;
618
inst.func_wrap_async(
619
"r1",
620
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
621
use tracing::Instrument;
622
let span = tracing::span!(
623
tracing::Level::TRACE, "wit-bindgen import", module =
624
"integers", function = "r1",
625
);
626
wasmtime::component::__internal::Box::new(
627
async move {
628
tracing::event!(tracing::Level::TRACE, "call");
629
let host = &mut host_getter(caller.data_mut());
630
let r = Host::r1(host).await;
631
tracing::event!(
632
tracing::Level::TRACE, result = tracing::field::debug(& r),
633
"return"
634
);
635
Ok((r,))
636
}
637
.instrument(span),
638
)
639
},
640
)?;
641
inst.func_wrap_async(
642
"r2",
643
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
644
use tracing::Instrument;
645
let span = tracing::span!(
646
tracing::Level::TRACE, "wit-bindgen import", module =
647
"integers", function = "r2",
648
);
649
wasmtime::component::__internal::Box::new(
650
async move {
651
tracing::event!(tracing::Level::TRACE, "call");
652
let host = &mut host_getter(caller.data_mut());
653
let r = Host::r2(host).await;
654
tracing::event!(
655
tracing::Level::TRACE, result = tracing::field::debug(& r),
656
"return"
657
);
658
Ok((r,))
659
}
660
.instrument(span),
661
)
662
},
663
)?;
664
inst.func_wrap_async(
665
"r3",
666
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
667
use tracing::Instrument;
668
let span = tracing::span!(
669
tracing::Level::TRACE, "wit-bindgen import", module =
670
"integers", function = "r3",
671
);
672
wasmtime::component::__internal::Box::new(
673
async move {
674
tracing::event!(tracing::Level::TRACE, "call");
675
let host = &mut host_getter(caller.data_mut());
676
let r = Host::r3(host).await;
677
tracing::event!(
678
tracing::Level::TRACE, result = tracing::field::debug(& r),
679
"return"
680
);
681
Ok((r,))
682
}
683
.instrument(span),
684
)
685
},
686
)?;
687
inst.func_wrap_async(
688
"r4",
689
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
690
use tracing::Instrument;
691
let span = tracing::span!(
692
tracing::Level::TRACE, "wit-bindgen import", module =
693
"integers", function = "r4",
694
);
695
wasmtime::component::__internal::Box::new(
696
async move {
697
tracing::event!(tracing::Level::TRACE, "call");
698
let host = &mut host_getter(caller.data_mut());
699
let r = Host::r4(host).await;
700
tracing::event!(
701
tracing::Level::TRACE, result = tracing::field::debug(& r),
702
"return"
703
);
704
Ok((r,))
705
}
706
.instrument(span),
707
)
708
},
709
)?;
710
inst.func_wrap_async(
711
"r5",
712
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
713
use tracing::Instrument;
714
let span = tracing::span!(
715
tracing::Level::TRACE, "wit-bindgen import", module =
716
"integers", function = "r5",
717
);
718
wasmtime::component::__internal::Box::new(
719
async move {
720
tracing::event!(tracing::Level::TRACE, "call");
721
let host = &mut host_getter(caller.data_mut());
722
let r = Host::r5(host).await;
723
tracing::event!(
724
tracing::Level::TRACE, result = tracing::field::debug(& r),
725
"return"
726
);
727
Ok((r,))
728
}
729
.instrument(span),
730
)
731
},
732
)?;
733
inst.func_wrap_async(
734
"r6",
735
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
736
use tracing::Instrument;
737
let span = tracing::span!(
738
tracing::Level::TRACE, "wit-bindgen import", module =
739
"integers", function = "r6",
740
);
741
wasmtime::component::__internal::Box::new(
742
async move {
743
tracing::event!(tracing::Level::TRACE, "call");
744
let host = &mut host_getter(caller.data_mut());
745
let r = Host::r6(host).await;
746
tracing::event!(
747
tracing::Level::TRACE, result = tracing::field::debug(& r),
748
"return"
749
);
750
Ok((r,))
751
}
752
.instrument(span),
753
)
754
},
755
)?;
756
inst.func_wrap_async(
757
"r7",
758
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
759
use tracing::Instrument;
760
let span = tracing::span!(
761
tracing::Level::TRACE, "wit-bindgen import", module =
762
"integers", function = "r7",
763
);
764
wasmtime::component::__internal::Box::new(
765
async move {
766
tracing::event!(tracing::Level::TRACE, "call");
767
let host = &mut host_getter(caller.data_mut());
768
let r = Host::r7(host).await;
769
tracing::event!(
770
tracing::Level::TRACE, result = tracing::field::debug(& r),
771
"return"
772
);
773
Ok((r,))
774
}
775
.instrument(span),
776
)
777
},
778
)?;
779
inst.func_wrap_async(
780
"r8",
781
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
782
use tracing::Instrument;
783
let span = tracing::span!(
784
tracing::Level::TRACE, "wit-bindgen import", module =
785
"integers", function = "r8",
786
);
787
wasmtime::component::__internal::Box::new(
788
async move {
789
tracing::event!(tracing::Level::TRACE, "call");
790
let host = &mut host_getter(caller.data_mut());
791
let r = Host::r8(host).await;
792
tracing::event!(
793
tracing::Level::TRACE, result = tracing::field::debug(& r),
794
"return"
795
);
796
Ok((r,))
797
}
798
.instrument(span),
799
)
800
},
801
)?;
802
inst.func_wrap_async(
803
"pair-ret",
804
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
805
use tracing::Instrument;
806
let span = tracing::span!(
807
tracing::Level::TRACE, "wit-bindgen import", module =
808
"integers", function = "pair-ret",
809
);
810
wasmtime::component::__internal::Box::new(
811
async move {
812
tracing::event!(tracing::Level::TRACE, "call");
813
let host = &mut host_getter(caller.data_mut());
814
let r = Host::pair_ret(host).await;
815
tracing::event!(
816
tracing::Level::TRACE, result = tracing::field::debug(& r),
817
"return"
818
);
819
Ok((r,))
820
}
821
.instrument(span),
822
)
823
},
824
)?;
825
Ok(())
826
}
827
}
828
}
829
}
830
pub mod exports {
831
pub mod foo {
832
pub mod foo {
833
#[allow(clippy::all)]
834
pub mod integers {
835
#[allow(unused_imports)]
836
use wasmtime::component::__internal::Box;
837
#[derive(Clone)]
838
pub struct Guest {
839
a1: wasmtime::component::Func,
840
a2: wasmtime::component::Func,
841
a3: wasmtime::component::Func,
842
a4: wasmtime::component::Func,
843
a5: wasmtime::component::Func,
844
a6: wasmtime::component::Func,
845
a7: wasmtime::component::Func,
846
a8: wasmtime::component::Func,
847
a9: wasmtime::component::Func,
848
r1: wasmtime::component::Func,
849
r2: wasmtime::component::Func,
850
r3: wasmtime::component::Func,
851
r4: wasmtime::component::Func,
852
r5: wasmtime::component::Func,
853
r6: wasmtime::component::Func,
854
r7: wasmtime::component::Func,
855
r8: wasmtime::component::Func,
856
pair_ret: wasmtime::component::Func,
857
}
858
#[derive(Clone)]
859
pub struct GuestIndices {
860
a1: wasmtime::component::ComponentExportIndex,
861
a2: wasmtime::component::ComponentExportIndex,
862
a3: wasmtime::component::ComponentExportIndex,
863
a4: wasmtime::component::ComponentExportIndex,
864
a5: wasmtime::component::ComponentExportIndex,
865
a6: wasmtime::component::ComponentExportIndex,
866
a7: wasmtime::component::ComponentExportIndex,
867
a8: wasmtime::component::ComponentExportIndex,
868
a9: wasmtime::component::ComponentExportIndex,
869
r1: wasmtime::component::ComponentExportIndex,
870
r2: wasmtime::component::ComponentExportIndex,
871
r3: wasmtime::component::ComponentExportIndex,
872
r4: wasmtime::component::ComponentExportIndex,
873
r5: wasmtime::component::ComponentExportIndex,
874
r6: wasmtime::component::ComponentExportIndex,
875
r7: wasmtime::component::ComponentExportIndex,
876
r8: wasmtime::component::ComponentExportIndex,
877
pair_ret: wasmtime::component::ComponentExportIndex,
878
}
879
impl GuestIndices {
880
/// Constructor for [`GuestIndices`] which takes a
881
/// [`Component`](wasmtime::component::Component) as input and can be executed
882
/// before instantiation.
883
///
884
/// This constructor can be used to front-load string lookups to find exports
885
/// within a component.
886
pub fn new<_T>(
887
_instance_pre: &wasmtime::component::InstancePre<_T>,
888
) -> wasmtime::Result<GuestIndices> {
889
let instance = _instance_pre
890
.component()
891
.get_export_index(None, "foo:foo/integers")
892
.ok_or_else(|| {
893
wasmtime::format_err!(
894
"no exported instance named `foo:foo/integers`"
895
)
896
})?;
897
let mut lookup = move |name| {
898
_instance_pre
899
.component()
900
.get_export_index(Some(&instance), name)
901
.ok_or_else(|| {
902
wasmtime::format_err!(
903
"instance export `foo:foo/integers` does \
904
not have export `{name}`"
905
)
906
})
907
};
908
let _ = &mut lookup;
909
let a1 = lookup("a1")?;
910
let a2 = lookup("a2")?;
911
let a3 = lookup("a3")?;
912
let a4 = lookup("a4")?;
913
let a5 = lookup("a5")?;
914
let a6 = lookup("a6")?;
915
let a7 = lookup("a7")?;
916
let a8 = lookup("a8")?;
917
let a9 = lookup("a9")?;
918
let r1 = lookup("r1")?;
919
let r2 = lookup("r2")?;
920
let r3 = lookup("r3")?;
921
let r4 = lookup("r4")?;
922
let r5 = lookup("r5")?;
923
let r6 = lookup("r6")?;
924
let r7 = lookup("r7")?;
925
let r8 = lookup("r8")?;
926
let pair_ret = lookup("pair-ret")?;
927
Ok(GuestIndices {
928
a1,
929
a2,
930
a3,
931
a4,
932
a5,
933
a6,
934
a7,
935
a8,
936
a9,
937
r1,
938
r2,
939
r3,
940
r4,
941
r5,
942
r6,
943
r7,
944
r8,
945
pair_ret,
946
})
947
}
948
pub fn load(
949
&self,
950
mut store: impl wasmtime::AsContextMut,
951
instance: &wasmtime::component::Instance,
952
) -> wasmtime::Result<Guest> {
953
let _instance = instance;
954
let _instance_pre = _instance.instance_pre(&store);
955
let _instance_type = _instance_pre.instance_type();
956
let mut store = store.as_context_mut();
957
let _ = &mut store;
958
let a1 = *_instance
959
.get_typed_func::<(u8,), ()>(&mut store, &self.a1)?
960
.func();
961
let a2 = *_instance
962
.get_typed_func::<(i8,), ()>(&mut store, &self.a2)?
963
.func();
964
let a3 = *_instance
965
.get_typed_func::<(u16,), ()>(&mut store, &self.a3)?
966
.func();
967
let a4 = *_instance
968
.get_typed_func::<(i16,), ()>(&mut store, &self.a4)?
969
.func();
970
let a5 = *_instance
971
.get_typed_func::<(u32,), ()>(&mut store, &self.a5)?
972
.func();
973
let a6 = *_instance
974
.get_typed_func::<(i32,), ()>(&mut store, &self.a6)?
975
.func();
976
let a7 = *_instance
977
.get_typed_func::<(u64,), ()>(&mut store, &self.a7)?
978
.func();
979
let a8 = *_instance
980
.get_typed_func::<(i64,), ()>(&mut store, &self.a8)?
981
.func();
982
let a9 = *_instance
983
.get_typed_func::<
984
(u8, i8, u16, i16, u32, i32, u64, i64),
985
(),
986
>(&mut store, &self.a9)?
987
.func();
988
let r1 = *_instance
989
.get_typed_func::<(), (u8,)>(&mut store, &self.r1)?
990
.func();
991
let r2 = *_instance
992
.get_typed_func::<(), (i8,)>(&mut store, &self.r2)?
993
.func();
994
let r3 = *_instance
995
.get_typed_func::<(), (u16,)>(&mut store, &self.r3)?
996
.func();
997
let r4 = *_instance
998
.get_typed_func::<(), (i16,)>(&mut store, &self.r4)?
999
.func();
1000
let r5 = *_instance
1001
.get_typed_func::<(), (u32,)>(&mut store, &self.r5)?
1002
.func();
1003
let r6 = *_instance
1004
.get_typed_func::<(), (i32,)>(&mut store, &self.r6)?
1005
.func();
1006
let r7 = *_instance
1007
.get_typed_func::<(), (u64,)>(&mut store, &self.r7)?
1008
.func();
1009
let r8 = *_instance
1010
.get_typed_func::<(), (i64,)>(&mut store, &self.r8)?
1011
.func();
1012
let pair_ret = *_instance
1013
.get_typed_func::<
1014
(),
1015
((i64, u8),),
1016
>(&mut store, &self.pair_ret)?
1017
.func();
1018
Ok(Guest {
1019
a1,
1020
a2,
1021
a3,
1022
a4,
1023
a5,
1024
a6,
1025
a7,
1026
a8,
1027
a9,
1028
r1,
1029
r2,
1030
r3,
1031
r4,
1032
r5,
1033
r6,
1034
r7,
1035
r8,
1036
pair_ret,
1037
})
1038
}
1039
}
1040
impl Guest {
1041
pub async fn call_a1<S: wasmtime::AsContextMut>(
1042
&self,
1043
mut store: S,
1044
arg0: u8,
1045
) -> wasmtime::Result<()>
1046
where
1047
<S as wasmtime::AsContext>::Data: Send,
1048
{
1049
use tracing::Instrument;
1050
let span = tracing::span!(
1051
tracing::Level::TRACE, "wit-bindgen export", module =
1052
"foo:foo/integers", function = "a1",
1053
);
1054
let callee = unsafe {
1055
wasmtime::component::TypedFunc::<
1056
(u8,),
1057
(),
1058
>::new_unchecked(self.a1)
1059
};
1060
let () = callee
1061
.call_async(store.as_context_mut(), (arg0,))
1062
.instrument(span.clone())
1063
.await?;
1064
Ok(())
1065
}
1066
pub async fn call_a2<S: wasmtime::AsContextMut>(
1067
&self,
1068
mut store: S,
1069
arg0: i8,
1070
) -> wasmtime::Result<()>
1071
where
1072
<S as wasmtime::AsContext>::Data: Send,
1073
{
1074
use tracing::Instrument;
1075
let span = tracing::span!(
1076
tracing::Level::TRACE, "wit-bindgen export", module =
1077
"foo:foo/integers", function = "a2",
1078
);
1079
let callee = unsafe {
1080
wasmtime::component::TypedFunc::<
1081
(i8,),
1082
(),
1083
>::new_unchecked(self.a2)
1084
};
1085
let () = callee
1086
.call_async(store.as_context_mut(), (arg0,))
1087
.instrument(span.clone())
1088
.await?;
1089
Ok(())
1090
}
1091
pub async fn call_a3<S: wasmtime::AsContextMut>(
1092
&self,
1093
mut store: S,
1094
arg0: u16,
1095
) -> wasmtime::Result<()>
1096
where
1097
<S as wasmtime::AsContext>::Data: Send,
1098
{
1099
use tracing::Instrument;
1100
let span = tracing::span!(
1101
tracing::Level::TRACE, "wit-bindgen export", module =
1102
"foo:foo/integers", function = "a3",
1103
);
1104
let callee = unsafe {
1105
wasmtime::component::TypedFunc::<
1106
(u16,),
1107
(),
1108
>::new_unchecked(self.a3)
1109
};
1110
let () = callee
1111
.call_async(store.as_context_mut(), (arg0,))
1112
.instrument(span.clone())
1113
.await?;
1114
Ok(())
1115
}
1116
pub async fn call_a4<S: wasmtime::AsContextMut>(
1117
&self,
1118
mut store: S,
1119
arg0: i16,
1120
) -> wasmtime::Result<()>
1121
where
1122
<S as wasmtime::AsContext>::Data: Send,
1123
{
1124
use tracing::Instrument;
1125
let span = tracing::span!(
1126
tracing::Level::TRACE, "wit-bindgen export", module =
1127
"foo:foo/integers", function = "a4",
1128
);
1129
let callee = unsafe {
1130
wasmtime::component::TypedFunc::<
1131
(i16,),
1132
(),
1133
>::new_unchecked(self.a4)
1134
};
1135
let () = callee
1136
.call_async(store.as_context_mut(), (arg0,))
1137
.instrument(span.clone())
1138
.await?;
1139
Ok(())
1140
}
1141
pub async fn call_a5<S: wasmtime::AsContextMut>(
1142
&self,
1143
mut store: S,
1144
arg0: u32,
1145
) -> wasmtime::Result<()>
1146
where
1147
<S as wasmtime::AsContext>::Data: Send,
1148
{
1149
use tracing::Instrument;
1150
let span = tracing::span!(
1151
tracing::Level::TRACE, "wit-bindgen export", module =
1152
"foo:foo/integers", function = "a5",
1153
);
1154
let callee = unsafe {
1155
wasmtime::component::TypedFunc::<
1156
(u32,),
1157
(),
1158
>::new_unchecked(self.a5)
1159
};
1160
let () = callee
1161
.call_async(store.as_context_mut(), (arg0,))
1162
.instrument(span.clone())
1163
.await?;
1164
Ok(())
1165
}
1166
pub async fn call_a6<S: wasmtime::AsContextMut>(
1167
&self,
1168
mut store: S,
1169
arg0: i32,
1170
) -> wasmtime::Result<()>
1171
where
1172
<S as wasmtime::AsContext>::Data: Send,
1173
{
1174
use tracing::Instrument;
1175
let span = tracing::span!(
1176
tracing::Level::TRACE, "wit-bindgen export", module =
1177
"foo:foo/integers", function = "a6",
1178
);
1179
let callee = unsafe {
1180
wasmtime::component::TypedFunc::<
1181
(i32,),
1182
(),
1183
>::new_unchecked(self.a6)
1184
};
1185
let () = callee
1186
.call_async(store.as_context_mut(), (arg0,))
1187
.instrument(span.clone())
1188
.await?;
1189
Ok(())
1190
}
1191
pub async fn call_a7<S: wasmtime::AsContextMut>(
1192
&self,
1193
mut store: S,
1194
arg0: u64,
1195
) -> wasmtime::Result<()>
1196
where
1197
<S as wasmtime::AsContext>::Data: Send,
1198
{
1199
use tracing::Instrument;
1200
let span = tracing::span!(
1201
tracing::Level::TRACE, "wit-bindgen export", module =
1202
"foo:foo/integers", function = "a7",
1203
);
1204
let callee = unsafe {
1205
wasmtime::component::TypedFunc::<
1206
(u64,),
1207
(),
1208
>::new_unchecked(self.a7)
1209
};
1210
let () = callee
1211
.call_async(store.as_context_mut(), (arg0,))
1212
.instrument(span.clone())
1213
.await?;
1214
Ok(())
1215
}
1216
pub async fn call_a8<S: wasmtime::AsContextMut>(
1217
&self,
1218
mut store: S,
1219
arg0: i64,
1220
) -> wasmtime::Result<()>
1221
where
1222
<S as wasmtime::AsContext>::Data: Send,
1223
{
1224
use tracing::Instrument;
1225
let span = tracing::span!(
1226
tracing::Level::TRACE, "wit-bindgen export", module =
1227
"foo:foo/integers", function = "a8",
1228
);
1229
let callee = unsafe {
1230
wasmtime::component::TypedFunc::<
1231
(i64,),
1232
(),
1233
>::new_unchecked(self.a8)
1234
};
1235
let () = callee
1236
.call_async(store.as_context_mut(), (arg0,))
1237
.instrument(span.clone())
1238
.await?;
1239
Ok(())
1240
}
1241
pub async fn call_a9<S: wasmtime::AsContextMut>(
1242
&self,
1243
mut store: S,
1244
arg0: u8,
1245
arg1: i8,
1246
arg2: u16,
1247
arg3: i16,
1248
arg4: u32,
1249
arg5: i32,
1250
arg6: u64,
1251
arg7: i64,
1252
) -> wasmtime::Result<()>
1253
where
1254
<S as wasmtime::AsContext>::Data: Send,
1255
{
1256
use tracing::Instrument;
1257
let span = tracing::span!(
1258
tracing::Level::TRACE, "wit-bindgen export", module =
1259
"foo:foo/integers", function = "a9",
1260
);
1261
let callee = unsafe {
1262
wasmtime::component::TypedFunc::<
1263
(u8, i8, u16, i16, u32, i32, u64, i64),
1264
(),
1265
>::new_unchecked(self.a9)
1266
};
1267
let () = callee
1268
.call_async(
1269
store.as_context_mut(),
1270
(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7),
1271
)
1272
.instrument(span.clone())
1273
.await?;
1274
Ok(())
1275
}
1276
pub async fn call_r1<S: wasmtime::AsContextMut>(
1277
&self,
1278
mut store: S,
1279
) -> wasmtime::Result<u8>
1280
where
1281
<S as wasmtime::AsContext>::Data: Send,
1282
{
1283
use tracing::Instrument;
1284
let span = tracing::span!(
1285
tracing::Level::TRACE, "wit-bindgen export", module =
1286
"foo:foo/integers", function = "r1",
1287
);
1288
let callee = unsafe {
1289
wasmtime::component::TypedFunc::<
1290
(),
1291
(u8,),
1292
>::new_unchecked(self.r1)
1293
};
1294
let (ret0,) = callee
1295
.call_async(store.as_context_mut(), ())
1296
.instrument(span.clone())
1297
.await?;
1298
Ok(ret0)
1299
}
1300
pub async fn call_r2<S: wasmtime::AsContextMut>(
1301
&self,
1302
mut store: S,
1303
) -> wasmtime::Result<i8>
1304
where
1305
<S as wasmtime::AsContext>::Data: Send,
1306
{
1307
use tracing::Instrument;
1308
let span = tracing::span!(
1309
tracing::Level::TRACE, "wit-bindgen export", module =
1310
"foo:foo/integers", function = "r2",
1311
);
1312
let callee = unsafe {
1313
wasmtime::component::TypedFunc::<
1314
(),
1315
(i8,),
1316
>::new_unchecked(self.r2)
1317
};
1318
let (ret0,) = callee
1319
.call_async(store.as_context_mut(), ())
1320
.instrument(span.clone())
1321
.await?;
1322
Ok(ret0)
1323
}
1324
pub async fn call_r3<S: wasmtime::AsContextMut>(
1325
&self,
1326
mut store: S,
1327
) -> wasmtime::Result<u16>
1328
where
1329
<S as wasmtime::AsContext>::Data: Send,
1330
{
1331
use tracing::Instrument;
1332
let span = tracing::span!(
1333
tracing::Level::TRACE, "wit-bindgen export", module =
1334
"foo:foo/integers", function = "r3",
1335
);
1336
let callee = unsafe {
1337
wasmtime::component::TypedFunc::<
1338
(),
1339
(u16,),
1340
>::new_unchecked(self.r3)
1341
};
1342
let (ret0,) = callee
1343
.call_async(store.as_context_mut(), ())
1344
.instrument(span.clone())
1345
.await?;
1346
Ok(ret0)
1347
}
1348
pub async fn call_r4<S: wasmtime::AsContextMut>(
1349
&self,
1350
mut store: S,
1351
) -> wasmtime::Result<i16>
1352
where
1353
<S as wasmtime::AsContext>::Data: Send,
1354
{
1355
use tracing::Instrument;
1356
let span = tracing::span!(
1357
tracing::Level::TRACE, "wit-bindgen export", module =
1358
"foo:foo/integers", function = "r4",
1359
);
1360
let callee = unsafe {
1361
wasmtime::component::TypedFunc::<
1362
(),
1363
(i16,),
1364
>::new_unchecked(self.r4)
1365
};
1366
let (ret0,) = callee
1367
.call_async(store.as_context_mut(), ())
1368
.instrument(span.clone())
1369
.await?;
1370
Ok(ret0)
1371
}
1372
pub async fn call_r5<S: wasmtime::AsContextMut>(
1373
&self,
1374
mut store: S,
1375
) -> wasmtime::Result<u32>
1376
where
1377
<S as wasmtime::AsContext>::Data: Send,
1378
{
1379
use tracing::Instrument;
1380
let span = tracing::span!(
1381
tracing::Level::TRACE, "wit-bindgen export", module =
1382
"foo:foo/integers", function = "r5",
1383
);
1384
let callee = unsafe {
1385
wasmtime::component::TypedFunc::<
1386
(),
1387
(u32,),
1388
>::new_unchecked(self.r5)
1389
};
1390
let (ret0,) = callee
1391
.call_async(store.as_context_mut(), ())
1392
.instrument(span.clone())
1393
.await?;
1394
Ok(ret0)
1395
}
1396
pub async fn call_r6<S: wasmtime::AsContextMut>(
1397
&self,
1398
mut store: S,
1399
) -> wasmtime::Result<i32>
1400
where
1401
<S as wasmtime::AsContext>::Data: Send,
1402
{
1403
use tracing::Instrument;
1404
let span = tracing::span!(
1405
tracing::Level::TRACE, "wit-bindgen export", module =
1406
"foo:foo/integers", function = "r6",
1407
);
1408
let callee = unsafe {
1409
wasmtime::component::TypedFunc::<
1410
(),
1411
(i32,),
1412
>::new_unchecked(self.r6)
1413
};
1414
let (ret0,) = callee
1415
.call_async(store.as_context_mut(), ())
1416
.instrument(span.clone())
1417
.await?;
1418
Ok(ret0)
1419
}
1420
pub async fn call_r7<S: wasmtime::AsContextMut>(
1421
&self,
1422
mut store: S,
1423
) -> wasmtime::Result<u64>
1424
where
1425
<S as wasmtime::AsContext>::Data: Send,
1426
{
1427
use tracing::Instrument;
1428
let span = tracing::span!(
1429
tracing::Level::TRACE, "wit-bindgen export", module =
1430
"foo:foo/integers", function = "r7",
1431
);
1432
let callee = unsafe {
1433
wasmtime::component::TypedFunc::<
1434
(),
1435
(u64,),
1436
>::new_unchecked(self.r7)
1437
};
1438
let (ret0,) = callee
1439
.call_async(store.as_context_mut(), ())
1440
.instrument(span.clone())
1441
.await?;
1442
Ok(ret0)
1443
}
1444
pub async fn call_r8<S: wasmtime::AsContextMut>(
1445
&self,
1446
mut store: S,
1447
) -> wasmtime::Result<i64>
1448
where
1449
<S as wasmtime::AsContext>::Data: Send,
1450
{
1451
use tracing::Instrument;
1452
let span = tracing::span!(
1453
tracing::Level::TRACE, "wit-bindgen export", module =
1454
"foo:foo/integers", function = "r8",
1455
);
1456
let callee = unsafe {
1457
wasmtime::component::TypedFunc::<
1458
(),
1459
(i64,),
1460
>::new_unchecked(self.r8)
1461
};
1462
let (ret0,) = callee
1463
.call_async(store.as_context_mut(), ())
1464
.instrument(span.clone())
1465
.await?;
1466
Ok(ret0)
1467
}
1468
pub async fn call_pair_ret<S: wasmtime::AsContextMut>(
1469
&self,
1470
mut store: S,
1471
) -> wasmtime::Result<(i64, u8)>
1472
where
1473
<S as wasmtime::AsContext>::Data: Send,
1474
{
1475
use tracing::Instrument;
1476
let span = tracing::span!(
1477
tracing::Level::TRACE, "wit-bindgen export", module =
1478
"foo:foo/integers", function = "pair-ret",
1479
);
1480
let callee = unsafe {
1481
wasmtime::component::TypedFunc::<
1482
(),
1483
((i64, u8),),
1484
>::new_unchecked(self.pair_ret)
1485
};
1486
let (ret0,) = callee
1487
.call_async(store.as_context_mut(), ())
1488
.instrument(span.clone())
1489
.await?;
1490
Ok(ret0)
1491
}
1492
}
1493
}
1494
}
1495
}
1496
}
1497
1498