Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/component-macro/tests/expanded/lists_tracing_async.rs
3084 views
1
/// Auto-generated bindings for a pre-instantiated version of a
2
/// component which implements the world `the-lists`.
3
///
4
/// This structure is created through [`TheListsPre::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 [`TheLists`] as well.
9
pub struct TheListsPre<T: 'static> {
10
instance_pre: wasmtime::component::InstancePre<T>,
11
indices: TheListsIndices,
12
}
13
impl<T: 'static> Clone for TheListsPre<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> TheListsPre<_T> {
22
/// Creates a new copy of `TheListsPre` 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 = TheListsIndices::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 [`TheLists`] 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<TheLists> {
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> TheListsPre<_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<TheLists> {
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-lists`.
68
///
69
/// This is an implementation detail of [`TheListsPre`] and can
70
/// be constructed if needed as well.
71
///
72
/// For more information see [`TheLists`] as well.
73
#[derive(Clone)]
74
pub struct TheListsIndices {
75
interface0: exports::foo::foo::lists::GuestIndices,
76
}
77
/// Auto-generated bindings for an instance a component which
78
/// implements the world `the-lists`.
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
/// [`TheLists::instantiate`] which only needs a
85
/// [`Store`], [`Component`], and [`Linker`].
86
///
87
/// * Alternatively you can create a [`TheListsPre`] 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 [`TheListsPre::instantiate`] to
91
/// create a [`TheLists`].
92
///
93
/// * If you've instantiated the instance yourself already
94
/// then you can use [`TheLists::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 TheLists {
103
interface0: exports::foo::foo::lists::Guest,
104
}
105
const _: () = {
106
impl TheListsIndices {
107
/// Creates a new copy of `TheListsIndices` 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::lists::GuestIndices::new(_instance_pre)?;
118
Ok(TheListsIndices { interface0 })
119
}
120
/// Uses the indices stored in `self` to load an instance
121
/// of [`TheLists`] from the instance provided.
122
///
123
/// Note that at this time this method will additionally
124
/// perform type-checks of all exports.
125
pub fn load(
126
&self,
127
mut store: impl wasmtime::AsContextMut,
128
instance: &wasmtime::component::Instance,
129
) -> wasmtime::Result<TheLists> {
130
let _ = &mut store;
131
let _instance = instance;
132
let interface0 = self.interface0.load(&mut store, &_instance)?;
133
Ok(TheLists { interface0 })
134
}
135
}
136
impl TheLists {
137
/// Convenience wrapper around [`TheListsPre::new`] and
138
/// [`TheListsPre::instantiate`].
139
pub fn instantiate<_T>(
140
store: impl wasmtime::AsContextMut<Data = _T>,
141
component: &wasmtime::component::Component,
142
linker: &wasmtime::component::Linker<_T>,
143
) -> wasmtime::Result<TheLists> {
144
let pre = linker.instantiate_pre(component)?;
145
TheListsPre::new(pre)?.instantiate(store)
146
}
147
/// Convenience wrapper around [`TheListsIndices::new`] and
148
/// [`TheListsIndices::load`].
149
pub fn new(
150
mut store: impl wasmtime::AsContextMut,
151
instance: &wasmtime::component::Instance,
152
) -> wasmtime::Result<TheLists> {
153
let indices = TheListsIndices::new(&instance.instance_pre(&store))?;
154
indices.load(&mut store, instance)
155
}
156
/// Convenience wrapper around [`TheListsPre::new`] and
157
/// [`TheListsPre::instantiate_async`].
158
pub async fn instantiate_async<_T>(
159
store: impl wasmtime::AsContextMut<Data = _T>,
160
component: &wasmtime::component::Component,
161
linker: &wasmtime::component::Linker<_T>,
162
) -> wasmtime::Result<TheLists>
163
where
164
_T: Send,
165
{
166
let pre = linker.instantiate_pre(component)?;
167
TheListsPre::new(pre)?.instantiate_async(store).await
168
}
169
pub fn add_to_linker<T, D>(
170
linker: &mut wasmtime::component::Linker<T>,
171
host_getter: fn(&mut T) -> D::Data<'_>,
172
) -> wasmtime::Result<()>
173
where
174
D: foo::foo::lists::HostWithStore + Send,
175
for<'a> D::Data<'a>: foo::foo::lists::Host + Send,
176
T: 'static + Send,
177
{
178
foo::foo::lists::add_to_linker::<T, D>(linker, host_getter)?;
179
Ok(())
180
}
181
pub fn foo_foo_lists(&self) -> &exports::foo::foo::lists::Guest {
182
&self.interface0
183
}
184
}
185
};
186
pub mod foo {
187
pub mod foo {
188
#[allow(clippy::all)]
189
pub mod lists {
190
#[allow(unused_imports)]
191
use wasmtime::component::__internal::Box;
192
#[derive(wasmtime::component::ComponentType)]
193
#[derive(wasmtime::component::Lift)]
194
#[derive(wasmtime::component::Lower)]
195
#[component(record)]
196
#[derive(Clone)]
197
pub struct OtherRecord {
198
#[component(name = "a1")]
199
pub a1: u32,
200
#[component(name = "a2")]
201
pub a2: u64,
202
#[component(name = "a3")]
203
pub a3: i32,
204
#[component(name = "a4")]
205
pub a4: i64,
206
#[component(name = "b")]
207
pub b: wasmtime::component::__internal::String,
208
#[component(name = "c")]
209
pub c: wasmtime::component::__internal::Vec<u8>,
210
}
211
impl core::fmt::Debug for OtherRecord {
212
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
213
f.debug_struct("OtherRecord")
214
.field("a1", &self.a1)
215
.field("a2", &self.a2)
216
.field("a3", &self.a3)
217
.field("a4", &self.a4)
218
.field("b", &self.b)
219
.field("c", &self.c)
220
.finish()
221
}
222
}
223
const _: () = {
224
assert!(
225
48 == < OtherRecord as wasmtime::component::ComponentType >::SIZE32
226
);
227
assert!(
228
8 == < OtherRecord as wasmtime::component::ComponentType >::ALIGN32
229
);
230
};
231
#[derive(wasmtime::component::ComponentType)]
232
#[derive(wasmtime::component::Lift)]
233
#[derive(wasmtime::component::Lower)]
234
#[component(record)]
235
#[derive(Clone)]
236
pub struct SomeRecord {
237
#[component(name = "x")]
238
pub x: wasmtime::component::__internal::String,
239
#[component(name = "y")]
240
pub y: OtherRecord,
241
#[component(name = "z")]
242
pub z: wasmtime::component::__internal::Vec<OtherRecord>,
243
#[component(name = "c1")]
244
pub c1: u32,
245
#[component(name = "c2")]
246
pub c2: u64,
247
#[component(name = "c3")]
248
pub c3: i32,
249
#[component(name = "c4")]
250
pub c4: i64,
251
}
252
impl core::fmt::Debug for SomeRecord {
253
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
254
f.debug_struct("SomeRecord")
255
.field("x", &self.x)
256
.field("y", &self.y)
257
.field("z", &self.z)
258
.field("c1", &self.c1)
259
.field("c2", &self.c2)
260
.field("c3", &self.c3)
261
.field("c4", &self.c4)
262
.finish()
263
}
264
}
265
const _: () = {
266
assert!(
267
96 == < SomeRecord as wasmtime::component::ComponentType >::SIZE32
268
);
269
assert!(
270
8 == < SomeRecord as wasmtime::component::ComponentType >::ALIGN32
271
);
272
};
273
#[derive(wasmtime::component::ComponentType)]
274
#[derive(wasmtime::component::Lift)]
275
#[derive(wasmtime::component::Lower)]
276
#[component(variant)]
277
#[derive(Clone)]
278
pub enum OtherVariant {
279
#[component(name = "a")]
280
A,
281
#[component(name = "b")]
282
B(u32),
283
#[component(name = "c")]
284
C(wasmtime::component::__internal::String),
285
}
286
impl core::fmt::Debug for OtherVariant {
287
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
288
match self {
289
OtherVariant::A => f.debug_tuple("OtherVariant::A").finish(),
290
OtherVariant::B(e) => {
291
f.debug_tuple("OtherVariant::B").field(e).finish()
292
}
293
OtherVariant::C(e) => {
294
f.debug_tuple("OtherVariant::C").field(e).finish()
295
}
296
}
297
}
298
}
299
const _: () = {
300
assert!(
301
12 == < OtherVariant as wasmtime::component::ComponentType >::SIZE32
302
);
303
assert!(
304
4 == < OtherVariant as wasmtime::component::ComponentType >::ALIGN32
305
);
306
};
307
#[derive(wasmtime::component::ComponentType)]
308
#[derive(wasmtime::component::Lift)]
309
#[derive(wasmtime::component::Lower)]
310
#[component(variant)]
311
#[derive(Clone)]
312
pub enum SomeVariant {
313
#[component(name = "a")]
314
A(wasmtime::component::__internal::String),
315
#[component(name = "b")]
316
B,
317
#[component(name = "c")]
318
C(u32),
319
#[component(name = "d")]
320
D(wasmtime::component::__internal::Vec<OtherVariant>),
321
}
322
impl core::fmt::Debug for SomeVariant {
323
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
324
match self {
325
SomeVariant::A(e) => {
326
f.debug_tuple("SomeVariant::A").field(e).finish()
327
}
328
SomeVariant::B => f.debug_tuple("SomeVariant::B").finish(),
329
SomeVariant::C(e) => {
330
f.debug_tuple("SomeVariant::C").field(e).finish()
331
}
332
SomeVariant::D(e) => {
333
f.debug_tuple("SomeVariant::D").field(e).finish()
334
}
335
}
336
}
337
}
338
const _: () = {
339
assert!(
340
12 == < SomeVariant as wasmtime::component::ComponentType >::SIZE32
341
);
342
assert!(
343
4 == < SomeVariant as wasmtime::component::ComponentType >::ALIGN32
344
);
345
};
346
pub type LoadStoreAllSizes = wasmtime::component::__internal::Vec<
347
(
348
wasmtime::component::__internal::String,
349
u8,
350
i8,
351
u16,
352
i16,
353
u32,
354
i32,
355
u64,
356
i64,
357
f32,
358
f64,
359
char,
360
),
361
>;
362
const _: () = {
363
assert!(
364
8 == < LoadStoreAllSizes as wasmtime::component::ComponentType
365
>::SIZE32
366
);
367
assert!(
368
4 == < LoadStoreAllSizes as wasmtime::component::ComponentType
369
>::ALIGN32
370
);
371
};
372
pub trait HostWithStore: wasmtime::component::HasData + Send {}
373
impl<_T: ?Sized> HostWithStore for _T
374
where
375
_T: wasmtime::component::HasData + Send,
376
{}
377
pub trait Host: Send {
378
fn list_u8_param(
379
&mut self,
380
x: wasmtime::component::__internal::Vec<u8>,
381
) -> impl ::core::future::Future<Output = ()> + Send;
382
fn list_u16_param(
383
&mut self,
384
x: wasmtime::component::__internal::Vec<u16>,
385
) -> impl ::core::future::Future<Output = ()> + Send;
386
fn list_u32_param(
387
&mut self,
388
x: wasmtime::component::__internal::Vec<u32>,
389
) -> impl ::core::future::Future<Output = ()> + Send;
390
fn list_u64_param(
391
&mut self,
392
x: wasmtime::component::__internal::Vec<u64>,
393
) -> impl ::core::future::Future<Output = ()> + Send;
394
fn list_s8_param(
395
&mut self,
396
x: wasmtime::component::__internal::Vec<i8>,
397
) -> impl ::core::future::Future<Output = ()> + Send;
398
fn list_s16_param(
399
&mut self,
400
x: wasmtime::component::__internal::Vec<i16>,
401
) -> impl ::core::future::Future<Output = ()> + Send;
402
fn list_s32_param(
403
&mut self,
404
x: wasmtime::component::__internal::Vec<i32>,
405
) -> impl ::core::future::Future<Output = ()> + Send;
406
fn list_s64_param(
407
&mut self,
408
x: wasmtime::component::__internal::Vec<i64>,
409
) -> impl ::core::future::Future<Output = ()> + Send;
410
fn list_f32_param(
411
&mut self,
412
x: wasmtime::component::__internal::Vec<f32>,
413
) -> impl ::core::future::Future<Output = ()> + Send;
414
fn list_f64_param(
415
&mut self,
416
x: wasmtime::component::__internal::Vec<f64>,
417
) -> impl ::core::future::Future<Output = ()> + Send;
418
fn list_u8_ret(
419
&mut self,
420
) -> impl ::core::future::Future<
421
Output = wasmtime::component::__internal::Vec<u8>,
422
> + Send;
423
fn list_u16_ret(
424
&mut self,
425
) -> impl ::core::future::Future<
426
Output = wasmtime::component::__internal::Vec<u16>,
427
> + Send;
428
fn list_u32_ret(
429
&mut self,
430
) -> impl ::core::future::Future<
431
Output = wasmtime::component::__internal::Vec<u32>,
432
> + Send;
433
fn list_u64_ret(
434
&mut self,
435
) -> impl ::core::future::Future<
436
Output = wasmtime::component::__internal::Vec<u64>,
437
> + Send;
438
fn list_s8_ret(
439
&mut self,
440
) -> impl ::core::future::Future<
441
Output = wasmtime::component::__internal::Vec<i8>,
442
> + Send;
443
fn list_s16_ret(
444
&mut self,
445
) -> impl ::core::future::Future<
446
Output = wasmtime::component::__internal::Vec<i16>,
447
> + Send;
448
fn list_s32_ret(
449
&mut self,
450
) -> impl ::core::future::Future<
451
Output = wasmtime::component::__internal::Vec<i32>,
452
> + Send;
453
fn list_s64_ret(
454
&mut self,
455
) -> impl ::core::future::Future<
456
Output = wasmtime::component::__internal::Vec<i64>,
457
> + Send;
458
fn list_f32_ret(
459
&mut self,
460
) -> impl ::core::future::Future<
461
Output = wasmtime::component::__internal::Vec<f32>,
462
> + Send;
463
fn list_f64_ret(
464
&mut self,
465
) -> impl ::core::future::Future<
466
Output = wasmtime::component::__internal::Vec<f64>,
467
> + Send;
468
fn tuple_list(
469
&mut self,
470
x: wasmtime::component::__internal::Vec<(u8, i8)>,
471
) -> impl ::core::future::Future<
472
Output = wasmtime::component::__internal::Vec<(i64, u32)>,
473
> + Send;
474
fn string_list_arg(
475
&mut self,
476
a: wasmtime::component::__internal::Vec<
477
wasmtime::component::__internal::String,
478
>,
479
) -> impl ::core::future::Future<Output = ()> + Send;
480
fn string_list_ret(
481
&mut self,
482
) -> impl ::core::future::Future<
483
Output = wasmtime::component::__internal::Vec<
484
wasmtime::component::__internal::String,
485
>,
486
> + Send;
487
fn tuple_string_list(
488
&mut self,
489
x: wasmtime::component::__internal::Vec<
490
(u8, wasmtime::component::__internal::String),
491
>,
492
) -> impl ::core::future::Future<
493
Output = wasmtime::component::__internal::Vec<
494
(wasmtime::component::__internal::String, u8),
495
>,
496
> + Send;
497
fn string_list(
498
&mut self,
499
x: wasmtime::component::__internal::Vec<
500
wasmtime::component::__internal::String,
501
>,
502
) -> impl ::core::future::Future<
503
Output = wasmtime::component::__internal::Vec<
504
wasmtime::component::__internal::String,
505
>,
506
> + Send;
507
fn record_list(
508
&mut self,
509
x: wasmtime::component::__internal::Vec<SomeRecord>,
510
) -> impl ::core::future::Future<
511
Output = wasmtime::component::__internal::Vec<OtherRecord>,
512
> + Send;
513
fn record_list_reverse(
514
&mut self,
515
x: wasmtime::component::__internal::Vec<OtherRecord>,
516
) -> impl ::core::future::Future<
517
Output = wasmtime::component::__internal::Vec<SomeRecord>,
518
> + Send;
519
fn variant_list(
520
&mut self,
521
x: wasmtime::component::__internal::Vec<SomeVariant>,
522
) -> impl ::core::future::Future<
523
Output = wasmtime::component::__internal::Vec<OtherVariant>,
524
> + Send;
525
fn load_store_everything(
526
&mut self,
527
a: LoadStoreAllSizes,
528
) -> impl ::core::future::Future<Output = LoadStoreAllSizes> + Send;
529
}
530
impl<_T: Host + ?Sized + Send> Host for &mut _T {
531
fn list_u8_param(
532
&mut self,
533
x: wasmtime::component::__internal::Vec<u8>,
534
) -> impl ::core::future::Future<Output = ()> + Send {
535
async move { Host::list_u8_param(*self, x).await }
536
}
537
fn list_u16_param(
538
&mut self,
539
x: wasmtime::component::__internal::Vec<u16>,
540
) -> impl ::core::future::Future<Output = ()> + Send {
541
async move { Host::list_u16_param(*self, x).await }
542
}
543
fn list_u32_param(
544
&mut self,
545
x: wasmtime::component::__internal::Vec<u32>,
546
) -> impl ::core::future::Future<Output = ()> + Send {
547
async move { Host::list_u32_param(*self, x).await }
548
}
549
fn list_u64_param(
550
&mut self,
551
x: wasmtime::component::__internal::Vec<u64>,
552
) -> impl ::core::future::Future<Output = ()> + Send {
553
async move { Host::list_u64_param(*self, x).await }
554
}
555
fn list_s8_param(
556
&mut self,
557
x: wasmtime::component::__internal::Vec<i8>,
558
) -> impl ::core::future::Future<Output = ()> + Send {
559
async move { Host::list_s8_param(*self, x).await }
560
}
561
fn list_s16_param(
562
&mut self,
563
x: wasmtime::component::__internal::Vec<i16>,
564
) -> impl ::core::future::Future<Output = ()> + Send {
565
async move { Host::list_s16_param(*self, x).await }
566
}
567
fn list_s32_param(
568
&mut self,
569
x: wasmtime::component::__internal::Vec<i32>,
570
) -> impl ::core::future::Future<Output = ()> + Send {
571
async move { Host::list_s32_param(*self, x).await }
572
}
573
fn list_s64_param(
574
&mut self,
575
x: wasmtime::component::__internal::Vec<i64>,
576
) -> impl ::core::future::Future<Output = ()> + Send {
577
async move { Host::list_s64_param(*self, x).await }
578
}
579
fn list_f32_param(
580
&mut self,
581
x: wasmtime::component::__internal::Vec<f32>,
582
) -> impl ::core::future::Future<Output = ()> + Send {
583
async move { Host::list_f32_param(*self, x).await }
584
}
585
fn list_f64_param(
586
&mut self,
587
x: wasmtime::component::__internal::Vec<f64>,
588
) -> impl ::core::future::Future<Output = ()> + Send {
589
async move { Host::list_f64_param(*self, x).await }
590
}
591
fn list_u8_ret(
592
&mut self,
593
) -> impl ::core::future::Future<
594
Output = wasmtime::component::__internal::Vec<u8>,
595
> + Send {
596
async move { Host::list_u8_ret(*self).await }
597
}
598
fn list_u16_ret(
599
&mut self,
600
) -> impl ::core::future::Future<
601
Output = wasmtime::component::__internal::Vec<u16>,
602
> + Send {
603
async move { Host::list_u16_ret(*self).await }
604
}
605
fn list_u32_ret(
606
&mut self,
607
) -> impl ::core::future::Future<
608
Output = wasmtime::component::__internal::Vec<u32>,
609
> + Send {
610
async move { Host::list_u32_ret(*self).await }
611
}
612
fn list_u64_ret(
613
&mut self,
614
) -> impl ::core::future::Future<
615
Output = wasmtime::component::__internal::Vec<u64>,
616
> + Send {
617
async move { Host::list_u64_ret(*self).await }
618
}
619
fn list_s8_ret(
620
&mut self,
621
) -> impl ::core::future::Future<
622
Output = wasmtime::component::__internal::Vec<i8>,
623
> + Send {
624
async move { Host::list_s8_ret(*self).await }
625
}
626
fn list_s16_ret(
627
&mut self,
628
) -> impl ::core::future::Future<
629
Output = wasmtime::component::__internal::Vec<i16>,
630
> + Send {
631
async move { Host::list_s16_ret(*self).await }
632
}
633
fn list_s32_ret(
634
&mut self,
635
) -> impl ::core::future::Future<
636
Output = wasmtime::component::__internal::Vec<i32>,
637
> + Send {
638
async move { Host::list_s32_ret(*self).await }
639
}
640
fn list_s64_ret(
641
&mut self,
642
) -> impl ::core::future::Future<
643
Output = wasmtime::component::__internal::Vec<i64>,
644
> + Send {
645
async move { Host::list_s64_ret(*self).await }
646
}
647
fn list_f32_ret(
648
&mut self,
649
) -> impl ::core::future::Future<
650
Output = wasmtime::component::__internal::Vec<f32>,
651
> + Send {
652
async move { Host::list_f32_ret(*self).await }
653
}
654
fn list_f64_ret(
655
&mut self,
656
) -> impl ::core::future::Future<
657
Output = wasmtime::component::__internal::Vec<f64>,
658
> + Send {
659
async move { Host::list_f64_ret(*self).await }
660
}
661
fn tuple_list(
662
&mut self,
663
x: wasmtime::component::__internal::Vec<(u8, i8)>,
664
) -> impl ::core::future::Future<
665
Output = wasmtime::component::__internal::Vec<(i64, u32)>,
666
> + Send {
667
async move { Host::tuple_list(*self, x).await }
668
}
669
fn string_list_arg(
670
&mut self,
671
a: wasmtime::component::__internal::Vec<
672
wasmtime::component::__internal::String,
673
>,
674
) -> impl ::core::future::Future<Output = ()> + Send {
675
async move { Host::string_list_arg(*self, a).await }
676
}
677
fn string_list_ret(
678
&mut self,
679
) -> impl ::core::future::Future<
680
Output = wasmtime::component::__internal::Vec<
681
wasmtime::component::__internal::String,
682
>,
683
> + Send {
684
async move { Host::string_list_ret(*self).await }
685
}
686
fn tuple_string_list(
687
&mut self,
688
x: wasmtime::component::__internal::Vec<
689
(u8, wasmtime::component::__internal::String),
690
>,
691
) -> impl ::core::future::Future<
692
Output = wasmtime::component::__internal::Vec<
693
(wasmtime::component::__internal::String, u8),
694
>,
695
> + Send {
696
async move { Host::tuple_string_list(*self, x).await }
697
}
698
fn string_list(
699
&mut self,
700
x: wasmtime::component::__internal::Vec<
701
wasmtime::component::__internal::String,
702
>,
703
) -> impl ::core::future::Future<
704
Output = wasmtime::component::__internal::Vec<
705
wasmtime::component::__internal::String,
706
>,
707
> + Send {
708
async move { Host::string_list(*self, x).await }
709
}
710
fn record_list(
711
&mut self,
712
x: wasmtime::component::__internal::Vec<SomeRecord>,
713
) -> impl ::core::future::Future<
714
Output = wasmtime::component::__internal::Vec<OtherRecord>,
715
> + Send {
716
async move { Host::record_list(*self, x).await }
717
}
718
fn record_list_reverse(
719
&mut self,
720
x: wasmtime::component::__internal::Vec<OtherRecord>,
721
) -> impl ::core::future::Future<
722
Output = wasmtime::component::__internal::Vec<SomeRecord>,
723
> + Send {
724
async move { Host::record_list_reverse(*self, x).await }
725
}
726
fn variant_list(
727
&mut self,
728
x: wasmtime::component::__internal::Vec<SomeVariant>,
729
) -> impl ::core::future::Future<
730
Output = wasmtime::component::__internal::Vec<OtherVariant>,
731
> + Send {
732
async move { Host::variant_list(*self, x).await }
733
}
734
fn load_store_everything(
735
&mut self,
736
a: LoadStoreAllSizes,
737
) -> impl ::core::future::Future<Output = LoadStoreAllSizes> + Send {
738
async move { Host::load_store_everything(*self, a).await }
739
}
740
}
741
pub fn add_to_linker<T, D>(
742
linker: &mut wasmtime::component::Linker<T>,
743
host_getter: fn(&mut T) -> D::Data<'_>,
744
) -> wasmtime::Result<()>
745
where
746
D: HostWithStore,
747
for<'a> D::Data<'a>: Host,
748
T: 'static + Send,
749
{
750
let mut inst = linker.instance("foo:foo/lists")?;
751
inst.func_wrap_async(
752
"list-u8-param",
753
move |
754
mut caller: wasmtime::StoreContextMut<'_, T>,
755
(arg0,): (wasmtime::component::__internal::Vec<u8>,)|
756
{
757
use tracing::Instrument;
758
let span = tracing::span!(
759
tracing::Level::TRACE, "wit-bindgen import", module =
760
"lists", function = "list-u8-param",
761
);
762
wasmtime::component::__internal::Box::new(
763
async move {
764
tracing::event!(
765
tracing::Level::TRACE, x = tracing::field::debug("..."),
766
"call"
767
);
768
let host = &mut host_getter(caller.data_mut());
769
let r = Host::list_u8_param(host, arg0).await;
770
tracing::event!(
771
tracing::Level::TRACE, result = tracing::field::debug(& r),
772
"return"
773
);
774
Ok(r)
775
}
776
.instrument(span),
777
)
778
},
779
)?;
780
inst.func_wrap_async(
781
"list-u16-param",
782
move |
783
mut caller: wasmtime::StoreContextMut<'_, T>,
784
(arg0,): (wasmtime::component::__internal::Vec<u16>,)|
785
{
786
use tracing::Instrument;
787
let span = tracing::span!(
788
tracing::Level::TRACE, "wit-bindgen import", module =
789
"lists", function = "list-u16-param",
790
);
791
wasmtime::component::__internal::Box::new(
792
async move {
793
tracing::event!(
794
tracing::Level::TRACE, x = tracing::field::debug("..."),
795
"call"
796
);
797
let host = &mut host_getter(caller.data_mut());
798
let r = Host::list_u16_param(host, arg0).await;
799
tracing::event!(
800
tracing::Level::TRACE, result = tracing::field::debug(& r),
801
"return"
802
);
803
Ok(r)
804
}
805
.instrument(span),
806
)
807
},
808
)?;
809
inst.func_wrap_async(
810
"list-u32-param",
811
move |
812
mut caller: wasmtime::StoreContextMut<'_, T>,
813
(arg0,): (wasmtime::component::__internal::Vec<u32>,)|
814
{
815
use tracing::Instrument;
816
let span = tracing::span!(
817
tracing::Level::TRACE, "wit-bindgen import", module =
818
"lists", function = "list-u32-param",
819
);
820
wasmtime::component::__internal::Box::new(
821
async move {
822
tracing::event!(
823
tracing::Level::TRACE, x = tracing::field::debug("..."),
824
"call"
825
);
826
let host = &mut host_getter(caller.data_mut());
827
let r = Host::list_u32_param(host, arg0).await;
828
tracing::event!(
829
tracing::Level::TRACE, result = tracing::field::debug(& r),
830
"return"
831
);
832
Ok(r)
833
}
834
.instrument(span),
835
)
836
},
837
)?;
838
inst.func_wrap_async(
839
"list-u64-param",
840
move |
841
mut caller: wasmtime::StoreContextMut<'_, T>,
842
(arg0,): (wasmtime::component::__internal::Vec<u64>,)|
843
{
844
use tracing::Instrument;
845
let span = tracing::span!(
846
tracing::Level::TRACE, "wit-bindgen import", module =
847
"lists", function = "list-u64-param",
848
);
849
wasmtime::component::__internal::Box::new(
850
async move {
851
tracing::event!(
852
tracing::Level::TRACE, x = tracing::field::debug("..."),
853
"call"
854
);
855
let host = &mut host_getter(caller.data_mut());
856
let r = Host::list_u64_param(host, arg0).await;
857
tracing::event!(
858
tracing::Level::TRACE, result = tracing::field::debug(& r),
859
"return"
860
);
861
Ok(r)
862
}
863
.instrument(span),
864
)
865
},
866
)?;
867
inst.func_wrap_async(
868
"list-s8-param",
869
move |
870
mut caller: wasmtime::StoreContextMut<'_, T>,
871
(arg0,): (wasmtime::component::__internal::Vec<i8>,)|
872
{
873
use tracing::Instrument;
874
let span = tracing::span!(
875
tracing::Level::TRACE, "wit-bindgen import", module =
876
"lists", function = "list-s8-param",
877
);
878
wasmtime::component::__internal::Box::new(
879
async move {
880
tracing::event!(
881
tracing::Level::TRACE, x = tracing::field::debug("..."),
882
"call"
883
);
884
let host = &mut host_getter(caller.data_mut());
885
let r = Host::list_s8_param(host, arg0).await;
886
tracing::event!(
887
tracing::Level::TRACE, result = tracing::field::debug(& r),
888
"return"
889
);
890
Ok(r)
891
}
892
.instrument(span),
893
)
894
},
895
)?;
896
inst.func_wrap_async(
897
"list-s16-param",
898
move |
899
mut caller: wasmtime::StoreContextMut<'_, T>,
900
(arg0,): (wasmtime::component::__internal::Vec<i16>,)|
901
{
902
use tracing::Instrument;
903
let span = tracing::span!(
904
tracing::Level::TRACE, "wit-bindgen import", module =
905
"lists", function = "list-s16-param",
906
);
907
wasmtime::component::__internal::Box::new(
908
async move {
909
tracing::event!(
910
tracing::Level::TRACE, x = tracing::field::debug("..."),
911
"call"
912
);
913
let host = &mut host_getter(caller.data_mut());
914
let r = Host::list_s16_param(host, arg0).await;
915
tracing::event!(
916
tracing::Level::TRACE, result = tracing::field::debug(& r),
917
"return"
918
);
919
Ok(r)
920
}
921
.instrument(span),
922
)
923
},
924
)?;
925
inst.func_wrap_async(
926
"list-s32-param",
927
move |
928
mut caller: wasmtime::StoreContextMut<'_, T>,
929
(arg0,): (wasmtime::component::__internal::Vec<i32>,)|
930
{
931
use tracing::Instrument;
932
let span = tracing::span!(
933
tracing::Level::TRACE, "wit-bindgen import", module =
934
"lists", function = "list-s32-param",
935
);
936
wasmtime::component::__internal::Box::new(
937
async move {
938
tracing::event!(
939
tracing::Level::TRACE, x = tracing::field::debug("..."),
940
"call"
941
);
942
let host = &mut host_getter(caller.data_mut());
943
let r = Host::list_s32_param(host, arg0).await;
944
tracing::event!(
945
tracing::Level::TRACE, result = tracing::field::debug(& r),
946
"return"
947
);
948
Ok(r)
949
}
950
.instrument(span),
951
)
952
},
953
)?;
954
inst.func_wrap_async(
955
"list-s64-param",
956
move |
957
mut caller: wasmtime::StoreContextMut<'_, T>,
958
(arg0,): (wasmtime::component::__internal::Vec<i64>,)|
959
{
960
use tracing::Instrument;
961
let span = tracing::span!(
962
tracing::Level::TRACE, "wit-bindgen import", module =
963
"lists", function = "list-s64-param",
964
);
965
wasmtime::component::__internal::Box::new(
966
async move {
967
tracing::event!(
968
tracing::Level::TRACE, x = tracing::field::debug("..."),
969
"call"
970
);
971
let host = &mut host_getter(caller.data_mut());
972
let r = Host::list_s64_param(host, arg0).await;
973
tracing::event!(
974
tracing::Level::TRACE, result = tracing::field::debug(& r),
975
"return"
976
);
977
Ok(r)
978
}
979
.instrument(span),
980
)
981
},
982
)?;
983
inst.func_wrap_async(
984
"list-f32-param",
985
move |
986
mut caller: wasmtime::StoreContextMut<'_, T>,
987
(arg0,): (wasmtime::component::__internal::Vec<f32>,)|
988
{
989
use tracing::Instrument;
990
let span = tracing::span!(
991
tracing::Level::TRACE, "wit-bindgen import", module =
992
"lists", function = "list-f32-param",
993
);
994
wasmtime::component::__internal::Box::new(
995
async move {
996
tracing::event!(
997
tracing::Level::TRACE, x = tracing::field::debug("..."),
998
"call"
999
);
1000
let host = &mut host_getter(caller.data_mut());
1001
let r = Host::list_f32_param(host, arg0).await;
1002
tracing::event!(
1003
tracing::Level::TRACE, result = tracing::field::debug(& r),
1004
"return"
1005
);
1006
Ok(r)
1007
}
1008
.instrument(span),
1009
)
1010
},
1011
)?;
1012
inst.func_wrap_async(
1013
"list-f64-param",
1014
move |
1015
mut caller: wasmtime::StoreContextMut<'_, T>,
1016
(arg0,): (wasmtime::component::__internal::Vec<f64>,)|
1017
{
1018
use tracing::Instrument;
1019
let span = tracing::span!(
1020
tracing::Level::TRACE, "wit-bindgen import", module =
1021
"lists", function = "list-f64-param",
1022
);
1023
wasmtime::component::__internal::Box::new(
1024
async move {
1025
tracing::event!(
1026
tracing::Level::TRACE, x = tracing::field::debug("..."),
1027
"call"
1028
);
1029
let host = &mut host_getter(caller.data_mut());
1030
let r = Host::list_f64_param(host, arg0).await;
1031
tracing::event!(
1032
tracing::Level::TRACE, result = tracing::field::debug(& r),
1033
"return"
1034
);
1035
Ok(r)
1036
}
1037
.instrument(span),
1038
)
1039
},
1040
)?;
1041
inst.func_wrap_async(
1042
"list-u8-ret",
1043
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
1044
use tracing::Instrument;
1045
let span = tracing::span!(
1046
tracing::Level::TRACE, "wit-bindgen import", module =
1047
"lists", function = "list-u8-ret",
1048
);
1049
wasmtime::component::__internal::Box::new(
1050
async move {
1051
tracing::event!(tracing::Level::TRACE, "call");
1052
let host = &mut host_getter(caller.data_mut());
1053
let r = Host::list_u8_ret(host).await;
1054
tracing::event!(
1055
tracing::Level::TRACE, result =
1056
tracing::field::debug("..."), "return"
1057
);
1058
Ok((r,))
1059
}
1060
.instrument(span),
1061
)
1062
},
1063
)?;
1064
inst.func_wrap_async(
1065
"list-u16-ret",
1066
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
1067
use tracing::Instrument;
1068
let span = tracing::span!(
1069
tracing::Level::TRACE, "wit-bindgen import", module =
1070
"lists", function = "list-u16-ret",
1071
);
1072
wasmtime::component::__internal::Box::new(
1073
async move {
1074
tracing::event!(tracing::Level::TRACE, "call");
1075
let host = &mut host_getter(caller.data_mut());
1076
let r = Host::list_u16_ret(host).await;
1077
tracing::event!(
1078
tracing::Level::TRACE, result =
1079
tracing::field::debug("..."), "return"
1080
);
1081
Ok((r,))
1082
}
1083
.instrument(span),
1084
)
1085
},
1086
)?;
1087
inst.func_wrap_async(
1088
"list-u32-ret",
1089
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
1090
use tracing::Instrument;
1091
let span = tracing::span!(
1092
tracing::Level::TRACE, "wit-bindgen import", module =
1093
"lists", function = "list-u32-ret",
1094
);
1095
wasmtime::component::__internal::Box::new(
1096
async move {
1097
tracing::event!(tracing::Level::TRACE, "call");
1098
let host = &mut host_getter(caller.data_mut());
1099
let r = Host::list_u32_ret(host).await;
1100
tracing::event!(
1101
tracing::Level::TRACE, result =
1102
tracing::field::debug("..."), "return"
1103
);
1104
Ok((r,))
1105
}
1106
.instrument(span),
1107
)
1108
},
1109
)?;
1110
inst.func_wrap_async(
1111
"list-u64-ret",
1112
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
1113
use tracing::Instrument;
1114
let span = tracing::span!(
1115
tracing::Level::TRACE, "wit-bindgen import", module =
1116
"lists", function = "list-u64-ret",
1117
);
1118
wasmtime::component::__internal::Box::new(
1119
async move {
1120
tracing::event!(tracing::Level::TRACE, "call");
1121
let host = &mut host_getter(caller.data_mut());
1122
let r = Host::list_u64_ret(host).await;
1123
tracing::event!(
1124
tracing::Level::TRACE, result =
1125
tracing::field::debug("..."), "return"
1126
);
1127
Ok((r,))
1128
}
1129
.instrument(span),
1130
)
1131
},
1132
)?;
1133
inst.func_wrap_async(
1134
"list-s8-ret",
1135
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
1136
use tracing::Instrument;
1137
let span = tracing::span!(
1138
tracing::Level::TRACE, "wit-bindgen import", module =
1139
"lists", function = "list-s8-ret",
1140
);
1141
wasmtime::component::__internal::Box::new(
1142
async move {
1143
tracing::event!(tracing::Level::TRACE, "call");
1144
let host = &mut host_getter(caller.data_mut());
1145
let r = Host::list_s8_ret(host).await;
1146
tracing::event!(
1147
tracing::Level::TRACE, result =
1148
tracing::field::debug("..."), "return"
1149
);
1150
Ok((r,))
1151
}
1152
.instrument(span),
1153
)
1154
},
1155
)?;
1156
inst.func_wrap_async(
1157
"list-s16-ret",
1158
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
1159
use tracing::Instrument;
1160
let span = tracing::span!(
1161
tracing::Level::TRACE, "wit-bindgen import", module =
1162
"lists", function = "list-s16-ret",
1163
);
1164
wasmtime::component::__internal::Box::new(
1165
async move {
1166
tracing::event!(tracing::Level::TRACE, "call");
1167
let host = &mut host_getter(caller.data_mut());
1168
let r = Host::list_s16_ret(host).await;
1169
tracing::event!(
1170
tracing::Level::TRACE, result =
1171
tracing::field::debug("..."), "return"
1172
);
1173
Ok((r,))
1174
}
1175
.instrument(span),
1176
)
1177
},
1178
)?;
1179
inst.func_wrap_async(
1180
"list-s32-ret",
1181
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
1182
use tracing::Instrument;
1183
let span = tracing::span!(
1184
tracing::Level::TRACE, "wit-bindgen import", module =
1185
"lists", function = "list-s32-ret",
1186
);
1187
wasmtime::component::__internal::Box::new(
1188
async move {
1189
tracing::event!(tracing::Level::TRACE, "call");
1190
let host = &mut host_getter(caller.data_mut());
1191
let r = Host::list_s32_ret(host).await;
1192
tracing::event!(
1193
tracing::Level::TRACE, result =
1194
tracing::field::debug("..."), "return"
1195
);
1196
Ok((r,))
1197
}
1198
.instrument(span),
1199
)
1200
},
1201
)?;
1202
inst.func_wrap_async(
1203
"list-s64-ret",
1204
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
1205
use tracing::Instrument;
1206
let span = tracing::span!(
1207
tracing::Level::TRACE, "wit-bindgen import", module =
1208
"lists", function = "list-s64-ret",
1209
);
1210
wasmtime::component::__internal::Box::new(
1211
async move {
1212
tracing::event!(tracing::Level::TRACE, "call");
1213
let host = &mut host_getter(caller.data_mut());
1214
let r = Host::list_s64_ret(host).await;
1215
tracing::event!(
1216
tracing::Level::TRACE, result =
1217
tracing::field::debug("..."), "return"
1218
);
1219
Ok((r,))
1220
}
1221
.instrument(span),
1222
)
1223
},
1224
)?;
1225
inst.func_wrap_async(
1226
"list-f32-ret",
1227
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
1228
use tracing::Instrument;
1229
let span = tracing::span!(
1230
tracing::Level::TRACE, "wit-bindgen import", module =
1231
"lists", function = "list-f32-ret",
1232
);
1233
wasmtime::component::__internal::Box::new(
1234
async move {
1235
tracing::event!(tracing::Level::TRACE, "call");
1236
let host = &mut host_getter(caller.data_mut());
1237
let r = Host::list_f32_ret(host).await;
1238
tracing::event!(
1239
tracing::Level::TRACE, result =
1240
tracing::field::debug("..."), "return"
1241
);
1242
Ok((r,))
1243
}
1244
.instrument(span),
1245
)
1246
},
1247
)?;
1248
inst.func_wrap_async(
1249
"list-f64-ret",
1250
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
1251
use tracing::Instrument;
1252
let span = tracing::span!(
1253
tracing::Level::TRACE, "wit-bindgen import", module =
1254
"lists", function = "list-f64-ret",
1255
);
1256
wasmtime::component::__internal::Box::new(
1257
async move {
1258
tracing::event!(tracing::Level::TRACE, "call");
1259
let host = &mut host_getter(caller.data_mut());
1260
let r = Host::list_f64_ret(host).await;
1261
tracing::event!(
1262
tracing::Level::TRACE, result =
1263
tracing::field::debug("..."), "return"
1264
);
1265
Ok((r,))
1266
}
1267
.instrument(span),
1268
)
1269
},
1270
)?;
1271
inst.func_wrap_async(
1272
"tuple-list",
1273
move |
1274
mut caller: wasmtime::StoreContextMut<'_, T>,
1275
(arg0,): (wasmtime::component::__internal::Vec<(u8, i8)>,)|
1276
{
1277
use tracing::Instrument;
1278
let span = tracing::span!(
1279
tracing::Level::TRACE, "wit-bindgen import", module =
1280
"lists", function = "tuple-list",
1281
);
1282
wasmtime::component::__internal::Box::new(
1283
async move {
1284
tracing::event!(
1285
tracing::Level::TRACE, x = tracing::field::debug("..."),
1286
"call"
1287
);
1288
let host = &mut host_getter(caller.data_mut());
1289
let r = Host::tuple_list(host, arg0).await;
1290
tracing::event!(
1291
tracing::Level::TRACE, result =
1292
tracing::field::debug("..."), "return"
1293
);
1294
Ok((r,))
1295
}
1296
.instrument(span),
1297
)
1298
},
1299
)?;
1300
inst.func_wrap_async(
1301
"string-list-arg",
1302
move |
1303
mut caller: wasmtime::StoreContextMut<'_, T>,
1304
(
1305
arg0,
1306
): (
1307
wasmtime::component::__internal::Vec<
1308
wasmtime::component::__internal::String,
1309
>,
1310
)|
1311
{
1312
use tracing::Instrument;
1313
let span = tracing::span!(
1314
tracing::Level::TRACE, "wit-bindgen import", module =
1315
"lists", function = "string-list-arg",
1316
);
1317
wasmtime::component::__internal::Box::new(
1318
async move {
1319
tracing::event!(
1320
tracing::Level::TRACE, a = tracing::field::debug("..."),
1321
"call"
1322
);
1323
let host = &mut host_getter(caller.data_mut());
1324
let r = Host::string_list_arg(host, arg0).await;
1325
tracing::event!(
1326
tracing::Level::TRACE, result = tracing::field::debug(& r),
1327
"return"
1328
);
1329
Ok(r)
1330
}
1331
.instrument(span),
1332
)
1333
},
1334
)?;
1335
inst.func_wrap_async(
1336
"string-list-ret",
1337
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
1338
use tracing::Instrument;
1339
let span = tracing::span!(
1340
tracing::Level::TRACE, "wit-bindgen import", module =
1341
"lists", function = "string-list-ret",
1342
);
1343
wasmtime::component::__internal::Box::new(
1344
async move {
1345
tracing::event!(tracing::Level::TRACE, "call");
1346
let host = &mut host_getter(caller.data_mut());
1347
let r = Host::string_list_ret(host).await;
1348
tracing::event!(
1349
tracing::Level::TRACE, result =
1350
tracing::field::debug("..."), "return"
1351
);
1352
Ok((r,))
1353
}
1354
.instrument(span),
1355
)
1356
},
1357
)?;
1358
inst.func_wrap_async(
1359
"tuple-string-list",
1360
move |
1361
mut caller: wasmtime::StoreContextMut<'_, T>,
1362
(
1363
arg0,
1364
): (
1365
wasmtime::component::__internal::Vec<
1366
(u8, wasmtime::component::__internal::String),
1367
>,
1368
)|
1369
{
1370
use tracing::Instrument;
1371
let span = tracing::span!(
1372
tracing::Level::TRACE, "wit-bindgen import", module =
1373
"lists", function = "tuple-string-list",
1374
);
1375
wasmtime::component::__internal::Box::new(
1376
async move {
1377
tracing::event!(
1378
tracing::Level::TRACE, x = tracing::field::debug("..."),
1379
"call"
1380
);
1381
let host = &mut host_getter(caller.data_mut());
1382
let r = Host::tuple_string_list(host, arg0).await;
1383
tracing::event!(
1384
tracing::Level::TRACE, result =
1385
tracing::field::debug("..."), "return"
1386
);
1387
Ok((r,))
1388
}
1389
.instrument(span),
1390
)
1391
},
1392
)?;
1393
inst.func_wrap_async(
1394
"string-list",
1395
move |
1396
mut caller: wasmtime::StoreContextMut<'_, T>,
1397
(
1398
arg0,
1399
): (
1400
wasmtime::component::__internal::Vec<
1401
wasmtime::component::__internal::String,
1402
>,
1403
)|
1404
{
1405
use tracing::Instrument;
1406
let span = tracing::span!(
1407
tracing::Level::TRACE, "wit-bindgen import", module =
1408
"lists", function = "string-list",
1409
);
1410
wasmtime::component::__internal::Box::new(
1411
async move {
1412
tracing::event!(
1413
tracing::Level::TRACE, x = tracing::field::debug("..."),
1414
"call"
1415
);
1416
let host = &mut host_getter(caller.data_mut());
1417
let r = Host::string_list(host, arg0).await;
1418
tracing::event!(
1419
tracing::Level::TRACE, result =
1420
tracing::field::debug("..."), "return"
1421
);
1422
Ok((r,))
1423
}
1424
.instrument(span),
1425
)
1426
},
1427
)?;
1428
inst.func_wrap_async(
1429
"record-list",
1430
move |
1431
mut caller: wasmtime::StoreContextMut<'_, T>,
1432
(arg0,): (wasmtime::component::__internal::Vec<SomeRecord>,)|
1433
{
1434
use tracing::Instrument;
1435
let span = tracing::span!(
1436
tracing::Level::TRACE, "wit-bindgen import", module =
1437
"lists", function = "record-list",
1438
);
1439
wasmtime::component::__internal::Box::new(
1440
async move {
1441
tracing::event!(
1442
tracing::Level::TRACE, x = tracing::field::debug("..."),
1443
"call"
1444
);
1445
let host = &mut host_getter(caller.data_mut());
1446
let r = Host::record_list(host, arg0).await;
1447
tracing::event!(
1448
tracing::Level::TRACE, result =
1449
tracing::field::debug("..."), "return"
1450
);
1451
Ok((r,))
1452
}
1453
.instrument(span),
1454
)
1455
},
1456
)?;
1457
inst.func_wrap_async(
1458
"record-list-reverse",
1459
move |
1460
mut caller: wasmtime::StoreContextMut<'_, T>,
1461
(arg0,): (wasmtime::component::__internal::Vec<OtherRecord>,)|
1462
{
1463
use tracing::Instrument;
1464
let span = tracing::span!(
1465
tracing::Level::TRACE, "wit-bindgen import", module =
1466
"lists", function = "record-list-reverse",
1467
);
1468
wasmtime::component::__internal::Box::new(
1469
async move {
1470
tracing::event!(
1471
tracing::Level::TRACE, x = tracing::field::debug("..."),
1472
"call"
1473
);
1474
let host = &mut host_getter(caller.data_mut());
1475
let r = Host::record_list_reverse(host, arg0).await;
1476
tracing::event!(
1477
tracing::Level::TRACE, result =
1478
tracing::field::debug("..."), "return"
1479
);
1480
Ok((r,))
1481
}
1482
.instrument(span),
1483
)
1484
},
1485
)?;
1486
inst.func_wrap_async(
1487
"variant-list",
1488
move |
1489
mut caller: wasmtime::StoreContextMut<'_, T>,
1490
(arg0,): (wasmtime::component::__internal::Vec<SomeVariant>,)|
1491
{
1492
use tracing::Instrument;
1493
let span = tracing::span!(
1494
tracing::Level::TRACE, "wit-bindgen import", module =
1495
"lists", function = "variant-list",
1496
);
1497
wasmtime::component::__internal::Box::new(
1498
async move {
1499
tracing::event!(
1500
tracing::Level::TRACE, x = tracing::field::debug("..."),
1501
"call"
1502
);
1503
let host = &mut host_getter(caller.data_mut());
1504
let r = Host::variant_list(host, arg0).await;
1505
tracing::event!(
1506
tracing::Level::TRACE, result =
1507
tracing::field::debug("..."), "return"
1508
);
1509
Ok((r,))
1510
}
1511
.instrument(span),
1512
)
1513
},
1514
)?;
1515
inst.func_wrap_async(
1516
"load-store-everything",
1517
move |
1518
mut caller: wasmtime::StoreContextMut<'_, T>,
1519
(arg0,): (LoadStoreAllSizes,)|
1520
{
1521
use tracing::Instrument;
1522
let span = tracing::span!(
1523
tracing::Level::TRACE, "wit-bindgen import", module =
1524
"lists", function = "load-store-everything",
1525
);
1526
wasmtime::component::__internal::Box::new(
1527
async move {
1528
tracing::event!(
1529
tracing::Level::TRACE, a = tracing::field::debug("..."),
1530
"call"
1531
);
1532
let host = &mut host_getter(caller.data_mut());
1533
let r = Host::load_store_everything(host, arg0).await;
1534
tracing::event!(
1535
tracing::Level::TRACE, result =
1536
tracing::field::debug("..."), "return"
1537
);
1538
Ok((r,))
1539
}
1540
.instrument(span),
1541
)
1542
},
1543
)?;
1544
Ok(())
1545
}
1546
}
1547
}
1548
}
1549
pub mod exports {
1550
pub mod foo {
1551
pub mod foo {
1552
#[allow(clippy::all)]
1553
pub mod lists {
1554
#[allow(unused_imports)]
1555
use wasmtime::component::__internal::Box;
1556
#[derive(wasmtime::component::ComponentType)]
1557
#[derive(wasmtime::component::Lift)]
1558
#[derive(wasmtime::component::Lower)]
1559
#[component(record)]
1560
#[derive(Clone)]
1561
pub struct OtherRecord {
1562
#[component(name = "a1")]
1563
pub a1: u32,
1564
#[component(name = "a2")]
1565
pub a2: u64,
1566
#[component(name = "a3")]
1567
pub a3: i32,
1568
#[component(name = "a4")]
1569
pub a4: i64,
1570
#[component(name = "b")]
1571
pub b: wasmtime::component::__internal::String,
1572
#[component(name = "c")]
1573
pub c: wasmtime::component::__internal::Vec<u8>,
1574
}
1575
impl core::fmt::Debug for OtherRecord {
1576
fn fmt(
1577
&self,
1578
f: &mut core::fmt::Formatter<'_>,
1579
) -> core::fmt::Result {
1580
f.debug_struct("OtherRecord")
1581
.field("a1", &self.a1)
1582
.field("a2", &self.a2)
1583
.field("a3", &self.a3)
1584
.field("a4", &self.a4)
1585
.field("b", &self.b)
1586
.field("c", &self.c)
1587
.finish()
1588
}
1589
}
1590
const _: () = {
1591
assert!(
1592
48 == < OtherRecord as wasmtime::component::ComponentType
1593
>::SIZE32
1594
);
1595
assert!(
1596
8 == < OtherRecord as wasmtime::component::ComponentType
1597
>::ALIGN32
1598
);
1599
};
1600
#[derive(wasmtime::component::ComponentType)]
1601
#[derive(wasmtime::component::Lift)]
1602
#[derive(wasmtime::component::Lower)]
1603
#[component(record)]
1604
#[derive(Clone)]
1605
pub struct SomeRecord {
1606
#[component(name = "x")]
1607
pub x: wasmtime::component::__internal::String,
1608
#[component(name = "y")]
1609
pub y: OtherRecord,
1610
#[component(name = "z")]
1611
pub z: wasmtime::component::__internal::Vec<OtherRecord>,
1612
#[component(name = "c1")]
1613
pub c1: u32,
1614
#[component(name = "c2")]
1615
pub c2: u64,
1616
#[component(name = "c3")]
1617
pub c3: i32,
1618
#[component(name = "c4")]
1619
pub c4: i64,
1620
}
1621
impl core::fmt::Debug for SomeRecord {
1622
fn fmt(
1623
&self,
1624
f: &mut core::fmt::Formatter<'_>,
1625
) -> core::fmt::Result {
1626
f.debug_struct("SomeRecord")
1627
.field("x", &self.x)
1628
.field("y", &self.y)
1629
.field("z", &self.z)
1630
.field("c1", &self.c1)
1631
.field("c2", &self.c2)
1632
.field("c3", &self.c3)
1633
.field("c4", &self.c4)
1634
.finish()
1635
}
1636
}
1637
const _: () = {
1638
assert!(
1639
96 == < SomeRecord as wasmtime::component::ComponentType
1640
>::SIZE32
1641
);
1642
assert!(
1643
8 == < SomeRecord as wasmtime::component::ComponentType
1644
>::ALIGN32
1645
);
1646
};
1647
#[derive(wasmtime::component::ComponentType)]
1648
#[derive(wasmtime::component::Lift)]
1649
#[derive(wasmtime::component::Lower)]
1650
#[component(variant)]
1651
#[derive(Clone)]
1652
pub enum OtherVariant {
1653
#[component(name = "a")]
1654
A,
1655
#[component(name = "b")]
1656
B(u32),
1657
#[component(name = "c")]
1658
C(wasmtime::component::__internal::String),
1659
}
1660
impl core::fmt::Debug for OtherVariant {
1661
fn fmt(
1662
&self,
1663
f: &mut core::fmt::Formatter<'_>,
1664
) -> core::fmt::Result {
1665
match self {
1666
OtherVariant::A => f.debug_tuple("OtherVariant::A").finish(),
1667
OtherVariant::B(e) => {
1668
f.debug_tuple("OtherVariant::B").field(e).finish()
1669
}
1670
OtherVariant::C(e) => {
1671
f.debug_tuple("OtherVariant::C").field(e).finish()
1672
}
1673
}
1674
}
1675
}
1676
const _: () = {
1677
assert!(
1678
12 == < OtherVariant as wasmtime::component::ComponentType
1679
>::SIZE32
1680
);
1681
assert!(
1682
4 == < OtherVariant as wasmtime::component::ComponentType
1683
>::ALIGN32
1684
);
1685
};
1686
#[derive(wasmtime::component::ComponentType)]
1687
#[derive(wasmtime::component::Lift)]
1688
#[derive(wasmtime::component::Lower)]
1689
#[component(variant)]
1690
#[derive(Clone)]
1691
pub enum SomeVariant {
1692
#[component(name = "a")]
1693
A(wasmtime::component::__internal::String),
1694
#[component(name = "b")]
1695
B,
1696
#[component(name = "c")]
1697
C(u32),
1698
#[component(name = "d")]
1699
D(wasmtime::component::__internal::Vec<OtherVariant>),
1700
}
1701
impl core::fmt::Debug for SomeVariant {
1702
fn fmt(
1703
&self,
1704
f: &mut core::fmt::Formatter<'_>,
1705
) -> core::fmt::Result {
1706
match self {
1707
SomeVariant::A(e) => {
1708
f.debug_tuple("SomeVariant::A").field(e).finish()
1709
}
1710
SomeVariant::B => f.debug_tuple("SomeVariant::B").finish(),
1711
SomeVariant::C(e) => {
1712
f.debug_tuple("SomeVariant::C").field(e).finish()
1713
}
1714
SomeVariant::D(e) => {
1715
f.debug_tuple("SomeVariant::D").field(e).finish()
1716
}
1717
}
1718
}
1719
}
1720
const _: () = {
1721
assert!(
1722
12 == < SomeVariant as wasmtime::component::ComponentType
1723
>::SIZE32
1724
);
1725
assert!(
1726
4 == < SomeVariant as wasmtime::component::ComponentType
1727
>::ALIGN32
1728
);
1729
};
1730
pub type LoadStoreAllSizes = wasmtime::component::__internal::Vec<
1731
(
1732
wasmtime::component::__internal::String,
1733
u8,
1734
i8,
1735
u16,
1736
i16,
1737
u32,
1738
i32,
1739
u64,
1740
i64,
1741
f32,
1742
f64,
1743
char,
1744
),
1745
>;
1746
const _: () = {
1747
assert!(
1748
8 == < LoadStoreAllSizes as wasmtime::component::ComponentType
1749
>::SIZE32
1750
);
1751
assert!(
1752
4 == < LoadStoreAllSizes as wasmtime::component::ComponentType
1753
>::ALIGN32
1754
);
1755
};
1756
#[derive(Clone)]
1757
pub struct Guest {
1758
list_u8_param: wasmtime::component::Func,
1759
list_u16_param: wasmtime::component::Func,
1760
list_u32_param: wasmtime::component::Func,
1761
list_u64_param: wasmtime::component::Func,
1762
list_s8_param: wasmtime::component::Func,
1763
list_s16_param: wasmtime::component::Func,
1764
list_s32_param: wasmtime::component::Func,
1765
list_s64_param: wasmtime::component::Func,
1766
list_f32_param: wasmtime::component::Func,
1767
list_f64_param: wasmtime::component::Func,
1768
list_u8_ret: wasmtime::component::Func,
1769
list_u16_ret: wasmtime::component::Func,
1770
list_u32_ret: wasmtime::component::Func,
1771
list_u64_ret: wasmtime::component::Func,
1772
list_s8_ret: wasmtime::component::Func,
1773
list_s16_ret: wasmtime::component::Func,
1774
list_s32_ret: wasmtime::component::Func,
1775
list_s64_ret: wasmtime::component::Func,
1776
list_f32_ret: wasmtime::component::Func,
1777
list_f64_ret: wasmtime::component::Func,
1778
tuple_list: wasmtime::component::Func,
1779
string_list_arg: wasmtime::component::Func,
1780
string_list_ret: wasmtime::component::Func,
1781
tuple_string_list: wasmtime::component::Func,
1782
string_list: wasmtime::component::Func,
1783
record_list: wasmtime::component::Func,
1784
record_list_reverse: wasmtime::component::Func,
1785
variant_list: wasmtime::component::Func,
1786
load_store_everything: wasmtime::component::Func,
1787
}
1788
#[derive(Clone)]
1789
pub struct GuestIndices {
1790
list_u8_param: wasmtime::component::ComponentExportIndex,
1791
list_u16_param: wasmtime::component::ComponentExportIndex,
1792
list_u32_param: wasmtime::component::ComponentExportIndex,
1793
list_u64_param: wasmtime::component::ComponentExportIndex,
1794
list_s8_param: wasmtime::component::ComponentExportIndex,
1795
list_s16_param: wasmtime::component::ComponentExportIndex,
1796
list_s32_param: wasmtime::component::ComponentExportIndex,
1797
list_s64_param: wasmtime::component::ComponentExportIndex,
1798
list_f32_param: wasmtime::component::ComponentExportIndex,
1799
list_f64_param: wasmtime::component::ComponentExportIndex,
1800
list_u8_ret: wasmtime::component::ComponentExportIndex,
1801
list_u16_ret: wasmtime::component::ComponentExportIndex,
1802
list_u32_ret: wasmtime::component::ComponentExportIndex,
1803
list_u64_ret: wasmtime::component::ComponentExportIndex,
1804
list_s8_ret: wasmtime::component::ComponentExportIndex,
1805
list_s16_ret: wasmtime::component::ComponentExportIndex,
1806
list_s32_ret: wasmtime::component::ComponentExportIndex,
1807
list_s64_ret: wasmtime::component::ComponentExportIndex,
1808
list_f32_ret: wasmtime::component::ComponentExportIndex,
1809
list_f64_ret: wasmtime::component::ComponentExportIndex,
1810
tuple_list: wasmtime::component::ComponentExportIndex,
1811
string_list_arg: wasmtime::component::ComponentExportIndex,
1812
string_list_ret: wasmtime::component::ComponentExportIndex,
1813
tuple_string_list: wasmtime::component::ComponentExportIndex,
1814
string_list: wasmtime::component::ComponentExportIndex,
1815
record_list: wasmtime::component::ComponentExportIndex,
1816
record_list_reverse: wasmtime::component::ComponentExportIndex,
1817
variant_list: wasmtime::component::ComponentExportIndex,
1818
load_store_everything: wasmtime::component::ComponentExportIndex,
1819
}
1820
impl GuestIndices {
1821
/// Constructor for [`GuestIndices`] which takes a
1822
/// [`Component`](wasmtime::component::Component) as input and can be executed
1823
/// before instantiation.
1824
///
1825
/// This constructor can be used to front-load string lookups to find exports
1826
/// within a component.
1827
pub fn new<_T>(
1828
_instance_pre: &wasmtime::component::InstancePre<_T>,
1829
) -> wasmtime::Result<GuestIndices> {
1830
let instance = _instance_pre
1831
.component()
1832
.get_export_index(None, "foo:foo/lists")
1833
.ok_or_else(|| {
1834
wasmtime::format_err!(
1835
"no exported instance named `foo:foo/lists`"
1836
)
1837
})?;
1838
let mut lookup = move |name| {
1839
_instance_pre
1840
.component()
1841
.get_export_index(Some(&instance), name)
1842
.ok_or_else(|| {
1843
wasmtime::format_err!(
1844
"instance export `foo:foo/lists` does \
1845
not have export `{name}`"
1846
)
1847
})
1848
};
1849
let _ = &mut lookup;
1850
let list_u8_param = lookup("list-u8-param")?;
1851
let list_u16_param = lookup("list-u16-param")?;
1852
let list_u32_param = lookup("list-u32-param")?;
1853
let list_u64_param = lookup("list-u64-param")?;
1854
let list_s8_param = lookup("list-s8-param")?;
1855
let list_s16_param = lookup("list-s16-param")?;
1856
let list_s32_param = lookup("list-s32-param")?;
1857
let list_s64_param = lookup("list-s64-param")?;
1858
let list_f32_param = lookup("list-f32-param")?;
1859
let list_f64_param = lookup("list-f64-param")?;
1860
let list_u8_ret = lookup("list-u8-ret")?;
1861
let list_u16_ret = lookup("list-u16-ret")?;
1862
let list_u32_ret = lookup("list-u32-ret")?;
1863
let list_u64_ret = lookup("list-u64-ret")?;
1864
let list_s8_ret = lookup("list-s8-ret")?;
1865
let list_s16_ret = lookup("list-s16-ret")?;
1866
let list_s32_ret = lookup("list-s32-ret")?;
1867
let list_s64_ret = lookup("list-s64-ret")?;
1868
let list_f32_ret = lookup("list-f32-ret")?;
1869
let list_f64_ret = lookup("list-f64-ret")?;
1870
let tuple_list = lookup("tuple-list")?;
1871
let string_list_arg = lookup("string-list-arg")?;
1872
let string_list_ret = lookup("string-list-ret")?;
1873
let tuple_string_list = lookup("tuple-string-list")?;
1874
let string_list = lookup("string-list")?;
1875
let record_list = lookup("record-list")?;
1876
let record_list_reverse = lookup("record-list-reverse")?;
1877
let variant_list = lookup("variant-list")?;
1878
let load_store_everything = lookup("load-store-everything")?;
1879
Ok(GuestIndices {
1880
list_u8_param,
1881
list_u16_param,
1882
list_u32_param,
1883
list_u64_param,
1884
list_s8_param,
1885
list_s16_param,
1886
list_s32_param,
1887
list_s64_param,
1888
list_f32_param,
1889
list_f64_param,
1890
list_u8_ret,
1891
list_u16_ret,
1892
list_u32_ret,
1893
list_u64_ret,
1894
list_s8_ret,
1895
list_s16_ret,
1896
list_s32_ret,
1897
list_s64_ret,
1898
list_f32_ret,
1899
list_f64_ret,
1900
tuple_list,
1901
string_list_arg,
1902
string_list_ret,
1903
tuple_string_list,
1904
string_list,
1905
record_list,
1906
record_list_reverse,
1907
variant_list,
1908
load_store_everything,
1909
})
1910
}
1911
pub fn load(
1912
&self,
1913
mut store: impl wasmtime::AsContextMut,
1914
instance: &wasmtime::component::Instance,
1915
) -> wasmtime::Result<Guest> {
1916
let _instance = instance;
1917
let _instance_pre = _instance.instance_pre(&store);
1918
let _instance_type = _instance_pre.instance_type();
1919
let mut store = store.as_context_mut();
1920
let _ = &mut store;
1921
let list_u8_param = *_instance
1922
.get_typed_func::<
1923
(&[u8],),
1924
(),
1925
>(&mut store, &self.list_u8_param)?
1926
.func();
1927
let list_u16_param = *_instance
1928
.get_typed_func::<
1929
(&[u16],),
1930
(),
1931
>(&mut store, &self.list_u16_param)?
1932
.func();
1933
let list_u32_param = *_instance
1934
.get_typed_func::<
1935
(&[u32],),
1936
(),
1937
>(&mut store, &self.list_u32_param)?
1938
.func();
1939
let list_u64_param = *_instance
1940
.get_typed_func::<
1941
(&[u64],),
1942
(),
1943
>(&mut store, &self.list_u64_param)?
1944
.func();
1945
let list_s8_param = *_instance
1946
.get_typed_func::<
1947
(&[i8],),
1948
(),
1949
>(&mut store, &self.list_s8_param)?
1950
.func();
1951
let list_s16_param = *_instance
1952
.get_typed_func::<
1953
(&[i16],),
1954
(),
1955
>(&mut store, &self.list_s16_param)?
1956
.func();
1957
let list_s32_param = *_instance
1958
.get_typed_func::<
1959
(&[i32],),
1960
(),
1961
>(&mut store, &self.list_s32_param)?
1962
.func();
1963
let list_s64_param = *_instance
1964
.get_typed_func::<
1965
(&[i64],),
1966
(),
1967
>(&mut store, &self.list_s64_param)?
1968
.func();
1969
let list_f32_param = *_instance
1970
.get_typed_func::<
1971
(&[f32],),
1972
(),
1973
>(&mut store, &self.list_f32_param)?
1974
.func();
1975
let list_f64_param = *_instance
1976
.get_typed_func::<
1977
(&[f64],),
1978
(),
1979
>(&mut store, &self.list_f64_param)?
1980
.func();
1981
let list_u8_ret = *_instance
1982
.get_typed_func::<
1983
(),
1984
(wasmtime::component::__internal::Vec<u8>,),
1985
>(&mut store, &self.list_u8_ret)?
1986
.func();
1987
let list_u16_ret = *_instance
1988
.get_typed_func::<
1989
(),
1990
(wasmtime::component::__internal::Vec<u16>,),
1991
>(&mut store, &self.list_u16_ret)?
1992
.func();
1993
let list_u32_ret = *_instance
1994
.get_typed_func::<
1995
(),
1996
(wasmtime::component::__internal::Vec<u32>,),
1997
>(&mut store, &self.list_u32_ret)?
1998
.func();
1999
let list_u64_ret = *_instance
2000
.get_typed_func::<
2001
(),
2002
(wasmtime::component::__internal::Vec<u64>,),
2003
>(&mut store, &self.list_u64_ret)?
2004
.func();
2005
let list_s8_ret = *_instance
2006
.get_typed_func::<
2007
(),
2008
(wasmtime::component::__internal::Vec<i8>,),
2009
>(&mut store, &self.list_s8_ret)?
2010
.func();
2011
let list_s16_ret = *_instance
2012
.get_typed_func::<
2013
(),
2014
(wasmtime::component::__internal::Vec<i16>,),
2015
>(&mut store, &self.list_s16_ret)?
2016
.func();
2017
let list_s32_ret = *_instance
2018
.get_typed_func::<
2019
(),
2020
(wasmtime::component::__internal::Vec<i32>,),
2021
>(&mut store, &self.list_s32_ret)?
2022
.func();
2023
let list_s64_ret = *_instance
2024
.get_typed_func::<
2025
(),
2026
(wasmtime::component::__internal::Vec<i64>,),
2027
>(&mut store, &self.list_s64_ret)?
2028
.func();
2029
let list_f32_ret = *_instance
2030
.get_typed_func::<
2031
(),
2032
(wasmtime::component::__internal::Vec<f32>,),
2033
>(&mut store, &self.list_f32_ret)?
2034
.func();
2035
let list_f64_ret = *_instance
2036
.get_typed_func::<
2037
(),
2038
(wasmtime::component::__internal::Vec<f64>,),
2039
>(&mut store, &self.list_f64_ret)?
2040
.func();
2041
let tuple_list = *_instance
2042
.get_typed_func::<
2043
(&[(u8, i8)],),
2044
(wasmtime::component::__internal::Vec<(i64, u32)>,),
2045
>(&mut store, &self.tuple_list)?
2046
.func();
2047
let string_list_arg = *_instance
2048
.get_typed_func::<
2049
(&[wasmtime::component::__internal::String],),
2050
(),
2051
>(&mut store, &self.string_list_arg)?
2052
.func();
2053
let string_list_ret = *_instance
2054
.get_typed_func::<
2055
(),
2056
(
2057
wasmtime::component::__internal::Vec<
2058
wasmtime::component::__internal::String,
2059
>,
2060
),
2061
>(&mut store, &self.string_list_ret)?
2062
.func();
2063
let tuple_string_list = *_instance
2064
.get_typed_func::<
2065
(&[(u8, wasmtime::component::__internal::String)],),
2066
(
2067
wasmtime::component::__internal::Vec<
2068
(wasmtime::component::__internal::String, u8),
2069
>,
2070
),
2071
>(&mut store, &self.tuple_string_list)?
2072
.func();
2073
let string_list = *_instance
2074
.get_typed_func::<
2075
(&[wasmtime::component::__internal::String],),
2076
(
2077
wasmtime::component::__internal::Vec<
2078
wasmtime::component::__internal::String,
2079
>,
2080
),
2081
>(&mut store, &self.string_list)?
2082
.func();
2083
let record_list = *_instance
2084
.get_typed_func::<
2085
(&[SomeRecord],),
2086
(wasmtime::component::__internal::Vec<OtherRecord>,),
2087
>(&mut store, &self.record_list)?
2088
.func();
2089
let record_list_reverse = *_instance
2090
.get_typed_func::<
2091
(&[OtherRecord],),
2092
(wasmtime::component::__internal::Vec<SomeRecord>,),
2093
>(&mut store, &self.record_list_reverse)?
2094
.func();
2095
let variant_list = *_instance
2096
.get_typed_func::<
2097
(&[SomeVariant],),
2098
(wasmtime::component::__internal::Vec<OtherVariant>,),
2099
>(&mut store, &self.variant_list)?
2100
.func();
2101
let load_store_everything = *_instance
2102
.get_typed_func::<
2103
(&LoadStoreAllSizes,),
2104
(LoadStoreAllSizes,),
2105
>(&mut store, &self.load_store_everything)?
2106
.func();
2107
Ok(Guest {
2108
list_u8_param,
2109
list_u16_param,
2110
list_u32_param,
2111
list_u64_param,
2112
list_s8_param,
2113
list_s16_param,
2114
list_s32_param,
2115
list_s64_param,
2116
list_f32_param,
2117
list_f64_param,
2118
list_u8_ret,
2119
list_u16_ret,
2120
list_u32_ret,
2121
list_u64_ret,
2122
list_s8_ret,
2123
list_s16_ret,
2124
list_s32_ret,
2125
list_s64_ret,
2126
list_f32_ret,
2127
list_f64_ret,
2128
tuple_list,
2129
string_list_arg,
2130
string_list_ret,
2131
tuple_string_list,
2132
string_list,
2133
record_list,
2134
record_list_reverse,
2135
variant_list,
2136
load_store_everything,
2137
})
2138
}
2139
}
2140
impl Guest {
2141
pub async fn call_list_u8_param<S: wasmtime::AsContextMut>(
2142
&self,
2143
mut store: S,
2144
arg0: &[u8],
2145
) -> wasmtime::Result<()>
2146
where
2147
<S as wasmtime::AsContext>::Data: Send,
2148
{
2149
use tracing::Instrument;
2150
let span = tracing::span!(
2151
tracing::Level::TRACE, "wit-bindgen export", module =
2152
"foo:foo/lists", function = "list-u8-param",
2153
);
2154
let callee = unsafe {
2155
wasmtime::component::TypedFunc::<
2156
(&[u8],),
2157
(),
2158
>::new_unchecked(self.list_u8_param)
2159
};
2160
let () = callee
2161
.call_async(store.as_context_mut(), (arg0,))
2162
.instrument(span.clone())
2163
.await?;
2164
Ok(())
2165
}
2166
pub async fn call_list_u16_param<S: wasmtime::AsContextMut>(
2167
&self,
2168
mut store: S,
2169
arg0: &[u16],
2170
) -> wasmtime::Result<()>
2171
where
2172
<S as wasmtime::AsContext>::Data: Send,
2173
{
2174
use tracing::Instrument;
2175
let span = tracing::span!(
2176
tracing::Level::TRACE, "wit-bindgen export", module =
2177
"foo:foo/lists", function = "list-u16-param",
2178
);
2179
let callee = unsafe {
2180
wasmtime::component::TypedFunc::<
2181
(&[u16],),
2182
(),
2183
>::new_unchecked(self.list_u16_param)
2184
};
2185
let () = callee
2186
.call_async(store.as_context_mut(), (arg0,))
2187
.instrument(span.clone())
2188
.await?;
2189
Ok(())
2190
}
2191
pub async fn call_list_u32_param<S: wasmtime::AsContextMut>(
2192
&self,
2193
mut store: S,
2194
arg0: &[u32],
2195
) -> wasmtime::Result<()>
2196
where
2197
<S as wasmtime::AsContext>::Data: Send,
2198
{
2199
use tracing::Instrument;
2200
let span = tracing::span!(
2201
tracing::Level::TRACE, "wit-bindgen export", module =
2202
"foo:foo/lists", function = "list-u32-param",
2203
);
2204
let callee = unsafe {
2205
wasmtime::component::TypedFunc::<
2206
(&[u32],),
2207
(),
2208
>::new_unchecked(self.list_u32_param)
2209
};
2210
let () = callee
2211
.call_async(store.as_context_mut(), (arg0,))
2212
.instrument(span.clone())
2213
.await?;
2214
Ok(())
2215
}
2216
pub async fn call_list_u64_param<S: wasmtime::AsContextMut>(
2217
&self,
2218
mut store: S,
2219
arg0: &[u64],
2220
) -> wasmtime::Result<()>
2221
where
2222
<S as wasmtime::AsContext>::Data: Send,
2223
{
2224
use tracing::Instrument;
2225
let span = tracing::span!(
2226
tracing::Level::TRACE, "wit-bindgen export", module =
2227
"foo:foo/lists", function = "list-u64-param",
2228
);
2229
let callee = unsafe {
2230
wasmtime::component::TypedFunc::<
2231
(&[u64],),
2232
(),
2233
>::new_unchecked(self.list_u64_param)
2234
};
2235
let () = callee
2236
.call_async(store.as_context_mut(), (arg0,))
2237
.instrument(span.clone())
2238
.await?;
2239
Ok(())
2240
}
2241
pub async fn call_list_s8_param<S: wasmtime::AsContextMut>(
2242
&self,
2243
mut store: S,
2244
arg0: &[i8],
2245
) -> wasmtime::Result<()>
2246
where
2247
<S as wasmtime::AsContext>::Data: Send,
2248
{
2249
use tracing::Instrument;
2250
let span = tracing::span!(
2251
tracing::Level::TRACE, "wit-bindgen export", module =
2252
"foo:foo/lists", function = "list-s8-param",
2253
);
2254
let callee = unsafe {
2255
wasmtime::component::TypedFunc::<
2256
(&[i8],),
2257
(),
2258
>::new_unchecked(self.list_s8_param)
2259
};
2260
let () = callee
2261
.call_async(store.as_context_mut(), (arg0,))
2262
.instrument(span.clone())
2263
.await?;
2264
Ok(())
2265
}
2266
pub async fn call_list_s16_param<S: wasmtime::AsContextMut>(
2267
&self,
2268
mut store: S,
2269
arg0: &[i16],
2270
) -> wasmtime::Result<()>
2271
where
2272
<S as wasmtime::AsContext>::Data: Send,
2273
{
2274
use tracing::Instrument;
2275
let span = tracing::span!(
2276
tracing::Level::TRACE, "wit-bindgen export", module =
2277
"foo:foo/lists", function = "list-s16-param",
2278
);
2279
let callee = unsafe {
2280
wasmtime::component::TypedFunc::<
2281
(&[i16],),
2282
(),
2283
>::new_unchecked(self.list_s16_param)
2284
};
2285
let () = callee
2286
.call_async(store.as_context_mut(), (arg0,))
2287
.instrument(span.clone())
2288
.await?;
2289
Ok(())
2290
}
2291
pub async fn call_list_s32_param<S: wasmtime::AsContextMut>(
2292
&self,
2293
mut store: S,
2294
arg0: &[i32],
2295
) -> wasmtime::Result<()>
2296
where
2297
<S as wasmtime::AsContext>::Data: Send,
2298
{
2299
use tracing::Instrument;
2300
let span = tracing::span!(
2301
tracing::Level::TRACE, "wit-bindgen export", module =
2302
"foo:foo/lists", function = "list-s32-param",
2303
);
2304
let callee = unsafe {
2305
wasmtime::component::TypedFunc::<
2306
(&[i32],),
2307
(),
2308
>::new_unchecked(self.list_s32_param)
2309
};
2310
let () = callee
2311
.call_async(store.as_context_mut(), (arg0,))
2312
.instrument(span.clone())
2313
.await?;
2314
Ok(())
2315
}
2316
pub async fn call_list_s64_param<S: wasmtime::AsContextMut>(
2317
&self,
2318
mut store: S,
2319
arg0: &[i64],
2320
) -> wasmtime::Result<()>
2321
where
2322
<S as wasmtime::AsContext>::Data: Send,
2323
{
2324
use tracing::Instrument;
2325
let span = tracing::span!(
2326
tracing::Level::TRACE, "wit-bindgen export", module =
2327
"foo:foo/lists", function = "list-s64-param",
2328
);
2329
let callee = unsafe {
2330
wasmtime::component::TypedFunc::<
2331
(&[i64],),
2332
(),
2333
>::new_unchecked(self.list_s64_param)
2334
};
2335
let () = callee
2336
.call_async(store.as_context_mut(), (arg0,))
2337
.instrument(span.clone())
2338
.await?;
2339
Ok(())
2340
}
2341
pub async fn call_list_f32_param<S: wasmtime::AsContextMut>(
2342
&self,
2343
mut store: S,
2344
arg0: &[f32],
2345
) -> wasmtime::Result<()>
2346
where
2347
<S as wasmtime::AsContext>::Data: Send,
2348
{
2349
use tracing::Instrument;
2350
let span = tracing::span!(
2351
tracing::Level::TRACE, "wit-bindgen export", module =
2352
"foo:foo/lists", function = "list-f32-param",
2353
);
2354
let callee = unsafe {
2355
wasmtime::component::TypedFunc::<
2356
(&[f32],),
2357
(),
2358
>::new_unchecked(self.list_f32_param)
2359
};
2360
let () = callee
2361
.call_async(store.as_context_mut(), (arg0,))
2362
.instrument(span.clone())
2363
.await?;
2364
Ok(())
2365
}
2366
pub async fn call_list_f64_param<S: wasmtime::AsContextMut>(
2367
&self,
2368
mut store: S,
2369
arg0: &[f64],
2370
) -> wasmtime::Result<()>
2371
where
2372
<S as wasmtime::AsContext>::Data: Send,
2373
{
2374
use tracing::Instrument;
2375
let span = tracing::span!(
2376
tracing::Level::TRACE, "wit-bindgen export", module =
2377
"foo:foo/lists", function = "list-f64-param",
2378
);
2379
let callee = unsafe {
2380
wasmtime::component::TypedFunc::<
2381
(&[f64],),
2382
(),
2383
>::new_unchecked(self.list_f64_param)
2384
};
2385
let () = callee
2386
.call_async(store.as_context_mut(), (arg0,))
2387
.instrument(span.clone())
2388
.await?;
2389
Ok(())
2390
}
2391
pub async fn call_list_u8_ret<S: wasmtime::AsContextMut>(
2392
&self,
2393
mut store: S,
2394
) -> wasmtime::Result<wasmtime::component::__internal::Vec<u8>>
2395
where
2396
<S as wasmtime::AsContext>::Data: Send,
2397
{
2398
use tracing::Instrument;
2399
let span = tracing::span!(
2400
tracing::Level::TRACE, "wit-bindgen export", module =
2401
"foo:foo/lists", function = "list-u8-ret",
2402
);
2403
let callee = unsafe {
2404
wasmtime::component::TypedFunc::<
2405
(),
2406
(wasmtime::component::__internal::Vec<u8>,),
2407
>::new_unchecked(self.list_u8_ret)
2408
};
2409
let (ret0,) = callee
2410
.call_async(store.as_context_mut(), ())
2411
.instrument(span.clone())
2412
.await?;
2413
Ok(ret0)
2414
}
2415
pub async fn call_list_u16_ret<S: wasmtime::AsContextMut>(
2416
&self,
2417
mut store: S,
2418
) -> wasmtime::Result<wasmtime::component::__internal::Vec<u16>>
2419
where
2420
<S as wasmtime::AsContext>::Data: Send,
2421
{
2422
use tracing::Instrument;
2423
let span = tracing::span!(
2424
tracing::Level::TRACE, "wit-bindgen export", module =
2425
"foo:foo/lists", function = "list-u16-ret",
2426
);
2427
let callee = unsafe {
2428
wasmtime::component::TypedFunc::<
2429
(),
2430
(wasmtime::component::__internal::Vec<u16>,),
2431
>::new_unchecked(self.list_u16_ret)
2432
};
2433
let (ret0,) = callee
2434
.call_async(store.as_context_mut(), ())
2435
.instrument(span.clone())
2436
.await?;
2437
Ok(ret0)
2438
}
2439
pub async fn call_list_u32_ret<S: wasmtime::AsContextMut>(
2440
&self,
2441
mut store: S,
2442
) -> wasmtime::Result<wasmtime::component::__internal::Vec<u32>>
2443
where
2444
<S as wasmtime::AsContext>::Data: Send,
2445
{
2446
use tracing::Instrument;
2447
let span = tracing::span!(
2448
tracing::Level::TRACE, "wit-bindgen export", module =
2449
"foo:foo/lists", function = "list-u32-ret",
2450
);
2451
let callee = unsafe {
2452
wasmtime::component::TypedFunc::<
2453
(),
2454
(wasmtime::component::__internal::Vec<u32>,),
2455
>::new_unchecked(self.list_u32_ret)
2456
};
2457
let (ret0,) = callee
2458
.call_async(store.as_context_mut(), ())
2459
.instrument(span.clone())
2460
.await?;
2461
Ok(ret0)
2462
}
2463
pub async fn call_list_u64_ret<S: wasmtime::AsContextMut>(
2464
&self,
2465
mut store: S,
2466
) -> wasmtime::Result<wasmtime::component::__internal::Vec<u64>>
2467
where
2468
<S as wasmtime::AsContext>::Data: Send,
2469
{
2470
use tracing::Instrument;
2471
let span = tracing::span!(
2472
tracing::Level::TRACE, "wit-bindgen export", module =
2473
"foo:foo/lists", function = "list-u64-ret",
2474
);
2475
let callee = unsafe {
2476
wasmtime::component::TypedFunc::<
2477
(),
2478
(wasmtime::component::__internal::Vec<u64>,),
2479
>::new_unchecked(self.list_u64_ret)
2480
};
2481
let (ret0,) = callee
2482
.call_async(store.as_context_mut(), ())
2483
.instrument(span.clone())
2484
.await?;
2485
Ok(ret0)
2486
}
2487
pub async fn call_list_s8_ret<S: wasmtime::AsContextMut>(
2488
&self,
2489
mut store: S,
2490
) -> wasmtime::Result<wasmtime::component::__internal::Vec<i8>>
2491
where
2492
<S as wasmtime::AsContext>::Data: Send,
2493
{
2494
use tracing::Instrument;
2495
let span = tracing::span!(
2496
tracing::Level::TRACE, "wit-bindgen export", module =
2497
"foo:foo/lists", function = "list-s8-ret",
2498
);
2499
let callee = unsafe {
2500
wasmtime::component::TypedFunc::<
2501
(),
2502
(wasmtime::component::__internal::Vec<i8>,),
2503
>::new_unchecked(self.list_s8_ret)
2504
};
2505
let (ret0,) = callee
2506
.call_async(store.as_context_mut(), ())
2507
.instrument(span.clone())
2508
.await?;
2509
Ok(ret0)
2510
}
2511
pub async fn call_list_s16_ret<S: wasmtime::AsContextMut>(
2512
&self,
2513
mut store: S,
2514
) -> wasmtime::Result<wasmtime::component::__internal::Vec<i16>>
2515
where
2516
<S as wasmtime::AsContext>::Data: Send,
2517
{
2518
use tracing::Instrument;
2519
let span = tracing::span!(
2520
tracing::Level::TRACE, "wit-bindgen export", module =
2521
"foo:foo/lists", function = "list-s16-ret",
2522
);
2523
let callee = unsafe {
2524
wasmtime::component::TypedFunc::<
2525
(),
2526
(wasmtime::component::__internal::Vec<i16>,),
2527
>::new_unchecked(self.list_s16_ret)
2528
};
2529
let (ret0,) = callee
2530
.call_async(store.as_context_mut(), ())
2531
.instrument(span.clone())
2532
.await?;
2533
Ok(ret0)
2534
}
2535
pub async fn call_list_s32_ret<S: wasmtime::AsContextMut>(
2536
&self,
2537
mut store: S,
2538
) -> wasmtime::Result<wasmtime::component::__internal::Vec<i32>>
2539
where
2540
<S as wasmtime::AsContext>::Data: Send,
2541
{
2542
use tracing::Instrument;
2543
let span = tracing::span!(
2544
tracing::Level::TRACE, "wit-bindgen export", module =
2545
"foo:foo/lists", function = "list-s32-ret",
2546
);
2547
let callee = unsafe {
2548
wasmtime::component::TypedFunc::<
2549
(),
2550
(wasmtime::component::__internal::Vec<i32>,),
2551
>::new_unchecked(self.list_s32_ret)
2552
};
2553
let (ret0,) = callee
2554
.call_async(store.as_context_mut(), ())
2555
.instrument(span.clone())
2556
.await?;
2557
Ok(ret0)
2558
}
2559
pub async fn call_list_s64_ret<S: wasmtime::AsContextMut>(
2560
&self,
2561
mut store: S,
2562
) -> wasmtime::Result<wasmtime::component::__internal::Vec<i64>>
2563
where
2564
<S as wasmtime::AsContext>::Data: Send,
2565
{
2566
use tracing::Instrument;
2567
let span = tracing::span!(
2568
tracing::Level::TRACE, "wit-bindgen export", module =
2569
"foo:foo/lists", function = "list-s64-ret",
2570
);
2571
let callee = unsafe {
2572
wasmtime::component::TypedFunc::<
2573
(),
2574
(wasmtime::component::__internal::Vec<i64>,),
2575
>::new_unchecked(self.list_s64_ret)
2576
};
2577
let (ret0,) = callee
2578
.call_async(store.as_context_mut(), ())
2579
.instrument(span.clone())
2580
.await?;
2581
Ok(ret0)
2582
}
2583
pub async fn call_list_f32_ret<S: wasmtime::AsContextMut>(
2584
&self,
2585
mut store: S,
2586
) -> wasmtime::Result<wasmtime::component::__internal::Vec<f32>>
2587
where
2588
<S as wasmtime::AsContext>::Data: Send,
2589
{
2590
use tracing::Instrument;
2591
let span = tracing::span!(
2592
tracing::Level::TRACE, "wit-bindgen export", module =
2593
"foo:foo/lists", function = "list-f32-ret",
2594
);
2595
let callee = unsafe {
2596
wasmtime::component::TypedFunc::<
2597
(),
2598
(wasmtime::component::__internal::Vec<f32>,),
2599
>::new_unchecked(self.list_f32_ret)
2600
};
2601
let (ret0,) = callee
2602
.call_async(store.as_context_mut(), ())
2603
.instrument(span.clone())
2604
.await?;
2605
Ok(ret0)
2606
}
2607
pub async fn call_list_f64_ret<S: wasmtime::AsContextMut>(
2608
&self,
2609
mut store: S,
2610
) -> wasmtime::Result<wasmtime::component::__internal::Vec<f64>>
2611
where
2612
<S as wasmtime::AsContext>::Data: Send,
2613
{
2614
use tracing::Instrument;
2615
let span = tracing::span!(
2616
tracing::Level::TRACE, "wit-bindgen export", module =
2617
"foo:foo/lists", function = "list-f64-ret",
2618
);
2619
let callee = unsafe {
2620
wasmtime::component::TypedFunc::<
2621
(),
2622
(wasmtime::component::__internal::Vec<f64>,),
2623
>::new_unchecked(self.list_f64_ret)
2624
};
2625
let (ret0,) = callee
2626
.call_async(store.as_context_mut(), ())
2627
.instrument(span.clone())
2628
.await?;
2629
Ok(ret0)
2630
}
2631
pub async fn call_tuple_list<S: wasmtime::AsContextMut>(
2632
&self,
2633
mut store: S,
2634
arg0: &[(u8, i8)],
2635
) -> wasmtime::Result<
2636
wasmtime::component::__internal::Vec<(i64, u32)>,
2637
>
2638
where
2639
<S as wasmtime::AsContext>::Data: Send,
2640
{
2641
use tracing::Instrument;
2642
let span = tracing::span!(
2643
tracing::Level::TRACE, "wit-bindgen export", module =
2644
"foo:foo/lists", function = "tuple-list",
2645
);
2646
let callee = unsafe {
2647
wasmtime::component::TypedFunc::<
2648
(&[(u8, i8)],),
2649
(wasmtime::component::__internal::Vec<(i64, u32)>,),
2650
>::new_unchecked(self.tuple_list)
2651
};
2652
let (ret0,) = callee
2653
.call_async(store.as_context_mut(), (arg0,))
2654
.instrument(span.clone())
2655
.await?;
2656
Ok(ret0)
2657
}
2658
pub async fn call_string_list_arg<S: wasmtime::AsContextMut>(
2659
&self,
2660
mut store: S,
2661
arg0: &[wasmtime::component::__internal::String],
2662
) -> wasmtime::Result<()>
2663
where
2664
<S as wasmtime::AsContext>::Data: Send,
2665
{
2666
use tracing::Instrument;
2667
let span = tracing::span!(
2668
tracing::Level::TRACE, "wit-bindgen export", module =
2669
"foo:foo/lists", function = "string-list-arg",
2670
);
2671
let callee = unsafe {
2672
wasmtime::component::TypedFunc::<
2673
(&[wasmtime::component::__internal::String],),
2674
(),
2675
>::new_unchecked(self.string_list_arg)
2676
};
2677
let () = callee
2678
.call_async(store.as_context_mut(), (arg0,))
2679
.instrument(span.clone())
2680
.await?;
2681
Ok(())
2682
}
2683
pub async fn call_string_list_ret<S: wasmtime::AsContextMut>(
2684
&self,
2685
mut store: S,
2686
) -> wasmtime::Result<
2687
wasmtime::component::__internal::Vec<
2688
wasmtime::component::__internal::String,
2689
>,
2690
>
2691
where
2692
<S as wasmtime::AsContext>::Data: Send,
2693
{
2694
use tracing::Instrument;
2695
let span = tracing::span!(
2696
tracing::Level::TRACE, "wit-bindgen export", module =
2697
"foo:foo/lists", function = "string-list-ret",
2698
);
2699
let callee = unsafe {
2700
wasmtime::component::TypedFunc::<
2701
(),
2702
(
2703
wasmtime::component::__internal::Vec<
2704
wasmtime::component::__internal::String,
2705
>,
2706
),
2707
>::new_unchecked(self.string_list_ret)
2708
};
2709
let (ret0,) = callee
2710
.call_async(store.as_context_mut(), ())
2711
.instrument(span.clone())
2712
.await?;
2713
Ok(ret0)
2714
}
2715
pub async fn call_tuple_string_list<S: wasmtime::AsContextMut>(
2716
&self,
2717
mut store: S,
2718
arg0: &[(u8, wasmtime::component::__internal::String)],
2719
) -> wasmtime::Result<
2720
wasmtime::component::__internal::Vec<
2721
(wasmtime::component::__internal::String, u8),
2722
>,
2723
>
2724
where
2725
<S as wasmtime::AsContext>::Data: Send,
2726
{
2727
use tracing::Instrument;
2728
let span = tracing::span!(
2729
tracing::Level::TRACE, "wit-bindgen export", module =
2730
"foo:foo/lists", function = "tuple-string-list",
2731
);
2732
let callee = unsafe {
2733
wasmtime::component::TypedFunc::<
2734
(&[(u8, wasmtime::component::__internal::String)],),
2735
(
2736
wasmtime::component::__internal::Vec<
2737
(wasmtime::component::__internal::String, u8),
2738
>,
2739
),
2740
>::new_unchecked(self.tuple_string_list)
2741
};
2742
let (ret0,) = callee
2743
.call_async(store.as_context_mut(), (arg0,))
2744
.instrument(span.clone())
2745
.await?;
2746
Ok(ret0)
2747
}
2748
pub async fn call_string_list<S: wasmtime::AsContextMut>(
2749
&self,
2750
mut store: S,
2751
arg0: &[wasmtime::component::__internal::String],
2752
) -> wasmtime::Result<
2753
wasmtime::component::__internal::Vec<
2754
wasmtime::component::__internal::String,
2755
>,
2756
>
2757
where
2758
<S as wasmtime::AsContext>::Data: Send,
2759
{
2760
use tracing::Instrument;
2761
let span = tracing::span!(
2762
tracing::Level::TRACE, "wit-bindgen export", module =
2763
"foo:foo/lists", function = "string-list",
2764
);
2765
let callee = unsafe {
2766
wasmtime::component::TypedFunc::<
2767
(&[wasmtime::component::__internal::String],),
2768
(
2769
wasmtime::component::__internal::Vec<
2770
wasmtime::component::__internal::String,
2771
>,
2772
),
2773
>::new_unchecked(self.string_list)
2774
};
2775
let (ret0,) = callee
2776
.call_async(store.as_context_mut(), (arg0,))
2777
.instrument(span.clone())
2778
.await?;
2779
Ok(ret0)
2780
}
2781
pub async fn call_record_list<S: wasmtime::AsContextMut>(
2782
&self,
2783
mut store: S,
2784
arg0: &[SomeRecord],
2785
) -> wasmtime::Result<
2786
wasmtime::component::__internal::Vec<OtherRecord>,
2787
>
2788
where
2789
<S as wasmtime::AsContext>::Data: Send,
2790
{
2791
use tracing::Instrument;
2792
let span = tracing::span!(
2793
tracing::Level::TRACE, "wit-bindgen export", module =
2794
"foo:foo/lists", function = "record-list",
2795
);
2796
let callee = unsafe {
2797
wasmtime::component::TypedFunc::<
2798
(&[SomeRecord],),
2799
(wasmtime::component::__internal::Vec<OtherRecord>,),
2800
>::new_unchecked(self.record_list)
2801
};
2802
let (ret0,) = callee
2803
.call_async(store.as_context_mut(), (arg0,))
2804
.instrument(span.clone())
2805
.await?;
2806
Ok(ret0)
2807
}
2808
pub async fn call_record_list_reverse<S: wasmtime::AsContextMut>(
2809
&self,
2810
mut store: S,
2811
arg0: &[OtherRecord],
2812
) -> wasmtime::Result<
2813
wasmtime::component::__internal::Vec<SomeRecord>,
2814
>
2815
where
2816
<S as wasmtime::AsContext>::Data: Send,
2817
{
2818
use tracing::Instrument;
2819
let span = tracing::span!(
2820
tracing::Level::TRACE, "wit-bindgen export", module =
2821
"foo:foo/lists", function = "record-list-reverse",
2822
);
2823
let callee = unsafe {
2824
wasmtime::component::TypedFunc::<
2825
(&[OtherRecord],),
2826
(wasmtime::component::__internal::Vec<SomeRecord>,),
2827
>::new_unchecked(self.record_list_reverse)
2828
};
2829
let (ret0,) = callee
2830
.call_async(store.as_context_mut(), (arg0,))
2831
.instrument(span.clone())
2832
.await?;
2833
Ok(ret0)
2834
}
2835
pub async fn call_variant_list<S: wasmtime::AsContextMut>(
2836
&self,
2837
mut store: S,
2838
arg0: &[SomeVariant],
2839
) -> wasmtime::Result<
2840
wasmtime::component::__internal::Vec<OtherVariant>,
2841
>
2842
where
2843
<S as wasmtime::AsContext>::Data: Send,
2844
{
2845
use tracing::Instrument;
2846
let span = tracing::span!(
2847
tracing::Level::TRACE, "wit-bindgen export", module =
2848
"foo:foo/lists", function = "variant-list",
2849
);
2850
let callee = unsafe {
2851
wasmtime::component::TypedFunc::<
2852
(&[SomeVariant],),
2853
(wasmtime::component::__internal::Vec<OtherVariant>,),
2854
>::new_unchecked(self.variant_list)
2855
};
2856
let (ret0,) = callee
2857
.call_async(store.as_context_mut(), (arg0,))
2858
.instrument(span.clone())
2859
.await?;
2860
Ok(ret0)
2861
}
2862
pub async fn call_load_store_everything<S: wasmtime::AsContextMut>(
2863
&self,
2864
mut store: S,
2865
arg0: &LoadStoreAllSizes,
2866
) -> wasmtime::Result<LoadStoreAllSizes>
2867
where
2868
<S as wasmtime::AsContext>::Data: Send,
2869
{
2870
use tracing::Instrument;
2871
let span = tracing::span!(
2872
tracing::Level::TRACE, "wit-bindgen export", module =
2873
"foo:foo/lists", function = "load-store-everything",
2874
);
2875
let callee = unsafe {
2876
wasmtime::component::TypedFunc::<
2877
(&LoadStoreAllSizes,),
2878
(LoadStoreAllSizes,),
2879
>::new_unchecked(self.load_store_everything)
2880
};
2881
let (ret0,) = callee
2882
.call_async(store.as_context_mut(), (arg0,))
2883
.instrument(span.clone())
2884
.await?;
2885
Ok(ret0)
2886
}
2887
}
2888
}
2889
}
2890
}
2891
}
2892
2893