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