Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/component-macro/tests/expanded/lists_concurrent.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
fn list_u8_param<T>(
376
accessor: &wasmtime::component::Accessor<T, Self>,
377
x: wasmtime::component::__internal::Vec<u8>,
378
) -> impl ::core::future::Future<Output = ()> + Send;
379
fn list_u16_param<T>(
380
accessor: &wasmtime::component::Accessor<T, Self>,
381
x: wasmtime::component::__internal::Vec<u16>,
382
) -> impl ::core::future::Future<Output = ()> + Send;
383
fn list_u32_param<T>(
384
accessor: &wasmtime::component::Accessor<T, Self>,
385
x: wasmtime::component::__internal::Vec<u32>,
386
) -> impl ::core::future::Future<Output = ()> + Send;
387
fn list_u64_param<T>(
388
accessor: &wasmtime::component::Accessor<T, Self>,
389
x: wasmtime::component::__internal::Vec<u64>,
390
) -> impl ::core::future::Future<Output = ()> + Send;
391
fn list_s8_param<T>(
392
accessor: &wasmtime::component::Accessor<T, Self>,
393
x: wasmtime::component::__internal::Vec<i8>,
394
) -> impl ::core::future::Future<Output = ()> + Send;
395
fn list_s16_param<T>(
396
accessor: &wasmtime::component::Accessor<T, Self>,
397
x: wasmtime::component::__internal::Vec<i16>,
398
) -> impl ::core::future::Future<Output = ()> + Send;
399
fn list_s32_param<T>(
400
accessor: &wasmtime::component::Accessor<T, Self>,
401
x: wasmtime::component::__internal::Vec<i32>,
402
) -> impl ::core::future::Future<Output = ()> + Send;
403
fn list_s64_param<T>(
404
accessor: &wasmtime::component::Accessor<T, Self>,
405
x: wasmtime::component::__internal::Vec<i64>,
406
) -> impl ::core::future::Future<Output = ()> + Send;
407
fn list_f32_param<T>(
408
accessor: &wasmtime::component::Accessor<T, Self>,
409
x: wasmtime::component::__internal::Vec<f32>,
410
) -> impl ::core::future::Future<Output = ()> + Send;
411
fn list_f64_param<T>(
412
accessor: &wasmtime::component::Accessor<T, Self>,
413
x: wasmtime::component::__internal::Vec<f64>,
414
) -> impl ::core::future::Future<Output = ()> + Send;
415
fn list_u8_ret<T>(
416
accessor: &wasmtime::component::Accessor<T, Self>,
417
) -> impl ::core::future::Future<
418
Output = wasmtime::component::__internal::Vec<u8>,
419
> + Send;
420
fn list_u16_ret<T>(
421
accessor: &wasmtime::component::Accessor<T, Self>,
422
) -> impl ::core::future::Future<
423
Output = wasmtime::component::__internal::Vec<u16>,
424
> + Send;
425
fn list_u32_ret<T>(
426
accessor: &wasmtime::component::Accessor<T, Self>,
427
) -> impl ::core::future::Future<
428
Output = wasmtime::component::__internal::Vec<u32>,
429
> + Send;
430
fn list_u64_ret<T>(
431
accessor: &wasmtime::component::Accessor<T, Self>,
432
) -> impl ::core::future::Future<
433
Output = wasmtime::component::__internal::Vec<u64>,
434
> + Send;
435
fn list_s8_ret<T>(
436
accessor: &wasmtime::component::Accessor<T, Self>,
437
) -> impl ::core::future::Future<
438
Output = wasmtime::component::__internal::Vec<i8>,
439
> + Send;
440
fn list_s16_ret<T>(
441
accessor: &wasmtime::component::Accessor<T, Self>,
442
) -> impl ::core::future::Future<
443
Output = wasmtime::component::__internal::Vec<i16>,
444
> + Send;
445
fn list_s32_ret<T>(
446
accessor: &wasmtime::component::Accessor<T, Self>,
447
) -> impl ::core::future::Future<
448
Output = wasmtime::component::__internal::Vec<i32>,
449
> + Send;
450
fn list_s64_ret<T>(
451
accessor: &wasmtime::component::Accessor<T, Self>,
452
) -> impl ::core::future::Future<
453
Output = wasmtime::component::__internal::Vec<i64>,
454
> + Send;
455
fn list_f32_ret<T>(
456
accessor: &wasmtime::component::Accessor<T, Self>,
457
) -> impl ::core::future::Future<
458
Output = wasmtime::component::__internal::Vec<f32>,
459
> + Send;
460
fn list_f64_ret<T>(
461
accessor: &wasmtime::component::Accessor<T, Self>,
462
) -> impl ::core::future::Future<
463
Output = wasmtime::component::__internal::Vec<f64>,
464
> + Send;
465
fn tuple_list<T>(
466
accessor: &wasmtime::component::Accessor<T, Self>,
467
x: wasmtime::component::__internal::Vec<(u8, i8)>,
468
) -> impl ::core::future::Future<
469
Output = wasmtime::component::__internal::Vec<(i64, u32)>,
470
> + Send;
471
fn string_list_arg<T>(
472
accessor: &wasmtime::component::Accessor<T, Self>,
473
a: wasmtime::component::__internal::Vec<
474
wasmtime::component::__internal::String,
475
>,
476
) -> impl ::core::future::Future<Output = ()> + Send;
477
fn string_list_ret<T>(
478
accessor: &wasmtime::component::Accessor<T, Self>,
479
) -> impl ::core::future::Future<
480
Output = wasmtime::component::__internal::Vec<
481
wasmtime::component::__internal::String,
482
>,
483
> + Send;
484
fn tuple_string_list<T>(
485
accessor: &wasmtime::component::Accessor<T, Self>,
486
x: wasmtime::component::__internal::Vec<
487
(u8, wasmtime::component::__internal::String),
488
>,
489
) -> impl ::core::future::Future<
490
Output = wasmtime::component::__internal::Vec<
491
(wasmtime::component::__internal::String, u8),
492
>,
493
> + Send;
494
fn string_list<T>(
495
accessor: &wasmtime::component::Accessor<T, Self>,
496
x: wasmtime::component::__internal::Vec<
497
wasmtime::component::__internal::String,
498
>,
499
) -> impl ::core::future::Future<
500
Output = wasmtime::component::__internal::Vec<
501
wasmtime::component::__internal::String,
502
>,
503
> + Send;
504
fn record_list<T>(
505
accessor: &wasmtime::component::Accessor<T, Self>,
506
x: wasmtime::component::__internal::Vec<SomeRecord>,
507
) -> impl ::core::future::Future<
508
Output = wasmtime::component::__internal::Vec<OtherRecord>,
509
> + Send;
510
fn record_list_reverse<T>(
511
accessor: &wasmtime::component::Accessor<T, Self>,
512
x: wasmtime::component::__internal::Vec<OtherRecord>,
513
) -> impl ::core::future::Future<
514
Output = wasmtime::component::__internal::Vec<SomeRecord>,
515
> + Send;
516
fn variant_list<T>(
517
accessor: &wasmtime::component::Accessor<T, Self>,
518
x: wasmtime::component::__internal::Vec<SomeVariant>,
519
) -> impl ::core::future::Future<
520
Output = wasmtime::component::__internal::Vec<OtherVariant>,
521
> + Send;
522
fn load_store_everything<T>(
523
accessor: &wasmtime::component::Accessor<T, Self>,
524
a: LoadStoreAllSizes,
525
) -> impl ::core::future::Future<Output = LoadStoreAllSizes> + Send;
526
}
527
pub trait Host: Send {}
528
impl<_T: Host + ?Sized + Send> Host for &mut _T {}
529
pub fn add_to_linker<T, D>(
530
linker: &mut wasmtime::component::Linker<T>,
531
host_getter: fn(&mut T) -> D::Data<'_>,
532
) -> wasmtime::Result<()>
533
where
534
D: HostWithStore,
535
for<'a> D::Data<'a>: Host,
536
T: 'static + Send,
537
{
538
let mut inst = linker.instance("foo:foo/lists")?;
539
inst.func_wrap_concurrent(
540
"list-u8-param",
541
move |
542
caller: &wasmtime::component::Accessor<T>,
543
(arg0,): (wasmtime::component::__internal::Vec<u8>,)|
544
{
545
wasmtime::component::__internal::Box::pin(async move {
546
let host = &caller.with_getter(host_getter);
547
let r = <D as HostWithStore>::list_u8_param(host, arg0)
548
.await;
549
Ok(r)
550
})
551
},
552
)?;
553
inst.func_wrap_concurrent(
554
"list-u16-param",
555
move |
556
caller: &wasmtime::component::Accessor<T>,
557
(arg0,): (wasmtime::component::__internal::Vec<u16>,)|
558
{
559
wasmtime::component::__internal::Box::pin(async move {
560
let host = &caller.with_getter(host_getter);
561
let r = <D as HostWithStore>::list_u16_param(host, arg0)
562
.await;
563
Ok(r)
564
})
565
},
566
)?;
567
inst.func_wrap_concurrent(
568
"list-u32-param",
569
move |
570
caller: &wasmtime::component::Accessor<T>,
571
(arg0,): (wasmtime::component::__internal::Vec<u32>,)|
572
{
573
wasmtime::component::__internal::Box::pin(async move {
574
let host = &caller.with_getter(host_getter);
575
let r = <D as HostWithStore>::list_u32_param(host, arg0)
576
.await;
577
Ok(r)
578
})
579
},
580
)?;
581
inst.func_wrap_concurrent(
582
"list-u64-param",
583
move |
584
caller: &wasmtime::component::Accessor<T>,
585
(arg0,): (wasmtime::component::__internal::Vec<u64>,)|
586
{
587
wasmtime::component::__internal::Box::pin(async move {
588
let host = &caller.with_getter(host_getter);
589
let r = <D as HostWithStore>::list_u64_param(host, arg0)
590
.await;
591
Ok(r)
592
})
593
},
594
)?;
595
inst.func_wrap_concurrent(
596
"list-s8-param",
597
move |
598
caller: &wasmtime::component::Accessor<T>,
599
(arg0,): (wasmtime::component::__internal::Vec<i8>,)|
600
{
601
wasmtime::component::__internal::Box::pin(async move {
602
let host = &caller.with_getter(host_getter);
603
let r = <D as HostWithStore>::list_s8_param(host, arg0)
604
.await;
605
Ok(r)
606
})
607
},
608
)?;
609
inst.func_wrap_concurrent(
610
"list-s16-param",
611
move |
612
caller: &wasmtime::component::Accessor<T>,
613
(arg0,): (wasmtime::component::__internal::Vec<i16>,)|
614
{
615
wasmtime::component::__internal::Box::pin(async move {
616
let host = &caller.with_getter(host_getter);
617
let r = <D as HostWithStore>::list_s16_param(host, arg0)
618
.await;
619
Ok(r)
620
})
621
},
622
)?;
623
inst.func_wrap_concurrent(
624
"list-s32-param",
625
move |
626
caller: &wasmtime::component::Accessor<T>,
627
(arg0,): (wasmtime::component::__internal::Vec<i32>,)|
628
{
629
wasmtime::component::__internal::Box::pin(async move {
630
let host = &caller.with_getter(host_getter);
631
let r = <D as HostWithStore>::list_s32_param(host, arg0)
632
.await;
633
Ok(r)
634
})
635
},
636
)?;
637
inst.func_wrap_concurrent(
638
"list-s64-param",
639
move |
640
caller: &wasmtime::component::Accessor<T>,
641
(arg0,): (wasmtime::component::__internal::Vec<i64>,)|
642
{
643
wasmtime::component::__internal::Box::pin(async move {
644
let host = &caller.with_getter(host_getter);
645
let r = <D as HostWithStore>::list_s64_param(host, arg0)
646
.await;
647
Ok(r)
648
})
649
},
650
)?;
651
inst.func_wrap_concurrent(
652
"list-f32-param",
653
move |
654
caller: &wasmtime::component::Accessor<T>,
655
(arg0,): (wasmtime::component::__internal::Vec<f32>,)|
656
{
657
wasmtime::component::__internal::Box::pin(async move {
658
let host = &caller.with_getter(host_getter);
659
let r = <D as HostWithStore>::list_f32_param(host, arg0)
660
.await;
661
Ok(r)
662
})
663
},
664
)?;
665
inst.func_wrap_concurrent(
666
"list-f64-param",
667
move |
668
caller: &wasmtime::component::Accessor<T>,
669
(arg0,): (wasmtime::component::__internal::Vec<f64>,)|
670
{
671
wasmtime::component::__internal::Box::pin(async move {
672
let host = &caller.with_getter(host_getter);
673
let r = <D as HostWithStore>::list_f64_param(host, arg0)
674
.await;
675
Ok(r)
676
})
677
},
678
)?;
679
inst.func_wrap_concurrent(
680
"list-u8-ret",
681
move |caller: &wasmtime::component::Accessor<T>, (): ()| {
682
wasmtime::component::__internal::Box::pin(async move {
683
let host = &caller.with_getter(host_getter);
684
let r = <D as HostWithStore>::list_u8_ret(host).await;
685
Ok((r,))
686
})
687
},
688
)?;
689
inst.func_wrap_concurrent(
690
"list-u16-ret",
691
move |caller: &wasmtime::component::Accessor<T>, (): ()| {
692
wasmtime::component::__internal::Box::pin(async move {
693
let host = &caller.with_getter(host_getter);
694
let r = <D as HostWithStore>::list_u16_ret(host).await;
695
Ok((r,))
696
})
697
},
698
)?;
699
inst.func_wrap_concurrent(
700
"list-u32-ret",
701
move |caller: &wasmtime::component::Accessor<T>, (): ()| {
702
wasmtime::component::__internal::Box::pin(async move {
703
let host = &caller.with_getter(host_getter);
704
let r = <D as HostWithStore>::list_u32_ret(host).await;
705
Ok((r,))
706
})
707
},
708
)?;
709
inst.func_wrap_concurrent(
710
"list-u64-ret",
711
move |caller: &wasmtime::component::Accessor<T>, (): ()| {
712
wasmtime::component::__internal::Box::pin(async move {
713
let host = &caller.with_getter(host_getter);
714
let r = <D as HostWithStore>::list_u64_ret(host).await;
715
Ok((r,))
716
})
717
},
718
)?;
719
inst.func_wrap_concurrent(
720
"list-s8-ret",
721
move |caller: &wasmtime::component::Accessor<T>, (): ()| {
722
wasmtime::component::__internal::Box::pin(async move {
723
let host = &caller.with_getter(host_getter);
724
let r = <D as HostWithStore>::list_s8_ret(host).await;
725
Ok((r,))
726
})
727
},
728
)?;
729
inst.func_wrap_concurrent(
730
"list-s16-ret",
731
move |caller: &wasmtime::component::Accessor<T>, (): ()| {
732
wasmtime::component::__internal::Box::pin(async move {
733
let host = &caller.with_getter(host_getter);
734
let r = <D as HostWithStore>::list_s16_ret(host).await;
735
Ok((r,))
736
})
737
},
738
)?;
739
inst.func_wrap_concurrent(
740
"list-s32-ret",
741
move |caller: &wasmtime::component::Accessor<T>, (): ()| {
742
wasmtime::component::__internal::Box::pin(async move {
743
let host = &caller.with_getter(host_getter);
744
let r = <D as HostWithStore>::list_s32_ret(host).await;
745
Ok((r,))
746
})
747
},
748
)?;
749
inst.func_wrap_concurrent(
750
"list-s64-ret",
751
move |caller: &wasmtime::component::Accessor<T>, (): ()| {
752
wasmtime::component::__internal::Box::pin(async move {
753
let host = &caller.with_getter(host_getter);
754
let r = <D as HostWithStore>::list_s64_ret(host).await;
755
Ok((r,))
756
})
757
},
758
)?;
759
inst.func_wrap_concurrent(
760
"list-f32-ret",
761
move |caller: &wasmtime::component::Accessor<T>, (): ()| {
762
wasmtime::component::__internal::Box::pin(async move {
763
let host = &caller.with_getter(host_getter);
764
let r = <D as HostWithStore>::list_f32_ret(host).await;
765
Ok((r,))
766
})
767
},
768
)?;
769
inst.func_wrap_concurrent(
770
"list-f64-ret",
771
move |caller: &wasmtime::component::Accessor<T>, (): ()| {
772
wasmtime::component::__internal::Box::pin(async move {
773
let host = &caller.with_getter(host_getter);
774
let r = <D as HostWithStore>::list_f64_ret(host).await;
775
Ok((r,))
776
})
777
},
778
)?;
779
inst.func_wrap_concurrent(
780
"tuple-list",
781
move |
782
caller: &wasmtime::component::Accessor<T>,
783
(arg0,): (wasmtime::component::__internal::Vec<(u8, i8)>,)|
784
{
785
wasmtime::component::__internal::Box::pin(async move {
786
let host = &caller.with_getter(host_getter);
787
let r = <D as HostWithStore>::tuple_list(host, arg0).await;
788
Ok((r,))
789
})
790
},
791
)?;
792
inst.func_wrap_concurrent(
793
"string-list-arg",
794
move |
795
caller: &wasmtime::component::Accessor<T>,
796
(
797
arg0,
798
): (
799
wasmtime::component::__internal::Vec<
800
wasmtime::component::__internal::String,
801
>,
802
)|
803
{
804
wasmtime::component::__internal::Box::pin(async move {
805
let host = &caller.with_getter(host_getter);
806
let r = <D as HostWithStore>::string_list_arg(host, arg0)
807
.await;
808
Ok(r)
809
})
810
},
811
)?;
812
inst.func_wrap_concurrent(
813
"string-list-ret",
814
move |caller: &wasmtime::component::Accessor<T>, (): ()| {
815
wasmtime::component::__internal::Box::pin(async move {
816
let host = &caller.with_getter(host_getter);
817
let r = <D as HostWithStore>::string_list_ret(host).await;
818
Ok((r,))
819
})
820
},
821
)?;
822
inst.func_wrap_concurrent(
823
"tuple-string-list",
824
move |
825
caller: &wasmtime::component::Accessor<T>,
826
(
827
arg0,
828
): (
829
wasmtime::component::__internal::Vec<
830
(u8, wasmtime::component::__internal::String),
831
>,
832
)|
833
{
834
wasmtime::component::__internal::Box::pin(async move {
835
let host = &caller.with_getter(host_getter);
836
let r = <D as HostWithStore>::tuple_string_list(host, arg0)
837
.await;
838
Ok((r,))
839
})
840
},
841
)?;
842
inst.func_wrap_concurrent(
843
"string-list",
844
move |
845
caller: &wasmtime::component::Accessor<T>,
846
(
847
arg0,
848
): (
849
wasmtime::component::__internal::Vec<
850
wasmtime::component::__internal::String,
851
>,
852
)|
853
{
854
wasmtime::component::__internal::Box::pin(async move {
855
let host = &caller.with_getter(host_getter);
856
let r = <D as HostWithStore>::string_list(host, arg0).await;
857
Ok((r,))
858
})
859
},
860
)?;
861
inst.func_wrap_concurrent(
862
"record-list",
863
move |
864
caller: &wasmtime::component::Accessor<T>,
865
(arg0,): (wasmtime::component::__internal::Vec<SomeRecord>,)|
866
{
867
wasmtime::component::__internal::Box::pin(async move {
868
let host = &caller.with_getter(host_getter);
869
let r = <D as HostWithStore>::record_list(host, arg0).await;
870
Ok((r,))
871
})
872
},
873
)?;
874
inst.func_wrap_concurrent(
875
"record-list-reverse",
876
move |
877
caller: &wasmtime::component::Accessor<T>,
878
(arg0,): (wasmtime::component::__internal::Vec<OtherRecord>,)|
879
{
880
wasmtime::component::__internal::Box::pin(async move {
881
let host = &caller.with_getter(host_getter);
882
let r = <D as HostWithStore>::record_list_reverse(host, arg0)
883
.await;
884
Ok((r,))
885
})
886
},
887
)?;
888
inst.func_wrap_concurrent(
889
"variant-list",
890
move |
891
caller: &wasmtime::component::Accessor<T>,
892
(arg0,): (wasmtime::component::__internal::Vec<SomeVariant>,)|
893
{
894
wasmtime::component::__internal::Box::pin(async move {
895
let host = &caller.with_getter(host_getter);
896
let r = <D as HostWithStore>::variant_list(host, arg0).await;
897
Ok((r,))
898
})
899
},
900
)?;
901
inst.func_wrap_concurrent(
902
"load-store-everything",
903
move |
904
caller: &wasmtime::component::Accessor<T>,
905
(arg0,): (LoadStoreAllSizes,)|
906
{
907
wasmtime::component::__internal::Box::pin(async move {
908
let host = &caller.with_getter(host_getter);
909
let r = <D as HostWithStore>::load_store_everything(
910
host,
911
arg0,
912
)
913
.await;
914
Ok((r,))
915
})
916
},
917
)?;
918
Ok(())
919
}
920
}
921
}
922
}
923
pub mod exports {
924
pub mod foo {
925
pub mod foo {
926
#[allow(clippy::all)]
927
pub mod lists {
928
#[allow(unused_imports)]
929
use wasmtime::component::__internal::{anyhow, Box};
930
#[derive(wasmtime::component::ComponentType)]
931
#[derive(wasmtime::component::Lift)]
932
#[derive(wasmtime::component::Lower)]
933
#[component(record)]
934
#[derive(Clone)]
935
pub struct OtherRecord {
936
#[component(name = "a1")]
937
pub a1: u32,
938
#[component(name = "a2")]
939
pub a2: u64,
940
#[component(name = "a3")]
941
pub a3: i32,
942
#[component(name = "a4")]
943
pub a4: i64,
944
#[component(name = "b")]
945
pub b: wasmtime::component::__internal::String,
946
#[component(name = "c")]
947
pub c: wasmtime::component::__internal::Vec<u8>,
948
}
949
impl core::fmt::Debug for OtherRecord {
950
fn fmt(
951
&self,
952
f: &mut core::fmt::Formatter<'_>,
953
) -> core::fmt::Result {
954
f.debug_struct("OtherRecord")
955
.field("a1", &self.a1)
956
.field("a2", &self.a2)
957
.field("a3", &self.a3)
958
.field("a4", &self.a4)
959
.field("b", &self.b)
960
.field("c", &self.c)
961
.finish()
962
}
963
}
964
const _: () = {
965
assert!(
966
48 == < OtherRecord as wasmtime::component::ComponentType
967
>::SIZE32
968
);
969
assert!(
970
8 == < OtherRecord as wasmtime::component::ComponentType
971
>::ALIGN32
972
);
973
};
974
#[derive(wasmtime::component::ComponentType)]
975
#[derive(wasmtime::component::Lift)]
976
#[derive(wasmtime::component::Lower)]
977
#[component(record)]
978
#[derive(Clone)]
979
pub struct SomeRecord {
980
#[component(name = "x")]
981
pub x: wasmtime::component::__internal::String,
982
#[component(name = "y")]
983
pub y: OtherRecord,
984
#[component(name = "z")]
985
pub z: wasmtime::component::__internal::Vec<OtherRecord>,
986
#[component(name = "c1")]
987
pub c1: u32,
988
#[component(name = "c2")]
989
pub c2: u64,
990
#[component(name = "c3")]
991
pub c3: i32,
992
#[component(name = "c4")]
993
pub c4: i64,
994
}
995
impl core::fmt::Debug for SomeRecord {
996
fn fmt(
997
&self,
998
f: &mut core::fmt::Formatter<'_>,
999
) -> core::fmt::Result {
1000
f.debug_struct("SomeRecord")
1001
.field("x", &self.x)
1002
.field("y", &self.y)
1003
.field("z", &self.z)
1004
.field("c1", &self.c1)
1005
.field("c2", &self.c2)
1006
.field("c3", &self.c3)
1007
.field("c4", &self.c4)
1008
.finish()
1009
}
1010
}
1011
const _: () = {
1012
assert!(
1013
96 == < SomeRecord as wasmtime::component::ComponentType
1014
>::SIZE32
1015
);
1016
assert!(
1017
8 == < SomeRecord as wasmtime::component::ComponentType
1018
>::ALIGN32
1019
);
1020
};
1021
#[derive(wasmtime::component::ComponentType)]
1022
#[derive(wasmtime::component::Lift)]
1023
#[derive(wasmtime::component::Lower)]
1024
#[component(variant)]
1025
#[derive(Clone)]
1026
pub enum OtherVariant {
1027
#[component(name = "a")]
1028
A,
1029
#[component(name = "b")]
1030
B(u32),
1031
#[component(name = "c")]
1032
C(wasmtime::component::__internal::String),
1033
}
1034
impl core::fmt::Debug for OtherVariant {
1035
fn fmt(
1036
&self,
1037
f: &mut core::fmt::Formatter<'_>,
1038
) -> core::fmt::Result {
1039
match self {
1040
OtherVariant::A => f.debug_tuple("OtherVariant::A").finish(),
1041
OtherVariant::B(e) => {
1042
f.debug_tuple("OtherVariant::B").field(e).finish()
1043
}
1044
OtherVariant::C(e) => {
1045
f.debug_tuple("OtherVariant::C").field(e).finish()
1046
}
1047
}
1048
}
1049
}
1050
const _: () = {
1051
assert!(
1052
12 == < OtherVariant as wasmtime::component::ComponentType
1053
>::SIZE32
1054
);
1055
assert!(
1056
4 == < OtherVariant as wasmtime::component::ComponentType
1057
>::ALIGN32
1058
);
1059
};
1060
#[derive(wasmtime::component::ComponentType)]
1061
#[derive(wasmtime::component::Lift)]
1062
#[derive(wasmtime::component::Lower)]
1063
#[component(variant)]
1064
#[derive(Clone)]
1065
pub enum SomeVariant {
1066
#[component(name = "a")]
1067
A(wasmtime::component::__internal::String),
1068
#[component(name = "b")]
1069
B,
1070
#[component(name = "c")]
1071
C(u32),
1072
#[component(name = "d")]
1073
D(wasmtime::component::__internal::Vec<OtherVariant>),
1074
}
1075
impl core::fmt::Debug for SomeVariant {
1076
fn fmt(
1077
&self,
1078
f: &mut core::fmt::Formatter<'_>,
1079
) -> core::fmt::Result {
1080
match self {
1081
SomeVariant::A(e) => {
1082
f.debug_tuple("SomeVariant::A").field(e).finish()
1083
}
1084
SomeVariant::B => f.debug_tuple("SomeVariant::B").finish(),
1085
SomeVariant::C(e) => {
1086
f.debug_tuple("SomeVariant::C").field(e).finish()
1087
}
1088
SomeVariant::D(e) => {
1089
f.debug_tuple("SomeVariant::D").field(e).finish()
1090
}
1091
}
1092
}
1093
}
1094
const _: () = {
1095
assert!(
1096
12 == < SomeVariant as wasmtime::component::ComponentType
1097
>::SIZE32
1098
);
1099
assert!(
1100
4 == < SomeVariant as wasmtime::component::ComponentType
1101
>::ALIGN32
1102
);
1103
};
1104
pub type LoadStoreAllSizes = wasmtime::component::__internal::Vec<
1105
(
1106
wasmtime::component::__internal::String,
1107
u8,
1108
i8,
1109
u16,
1110
i16,
1111
u32,
1112
i32,
1113
u64,
1114
i64,
1115
f32,
1116
f64,
1117
char,
1118
),
1119
>;
1120
const _: () = {
1121
assert!(
1122
8 == < LoadStoreAllSizes as wasmtime::component::ComponentType
1123
>::SIZE32
1124
);
1125
assert!(
1126
4 == < LoadStoreAllSizes as wasmtime::component::ComponentType
1127
>::ALIGN32
1128
);
1129
};
1130
pub struct Guest {
1131
list_u8_param: wasmtime::component::Func,
1132
list_u16_param: wasmtime::component::Func,
1133
list_u32_param: wasmtime::component::Func,
1134
list_u64_param: wasmtime::component::Func,
1135
list_s8_param: wasmtime::component::Func,
1136
list_s16_param: wasmtime::component::Func,
1137
list_s32_param: wasmtime::component::Func,
1138
list_s64_param: wasmtime::component::Func,
1139
list_f32_param: wasmtime::component::Func,
1140
list_f64_param: wasmtime::component::Func,
1141
list_u8_ret: wasmtime::component::Func,
1142
list_u16_ret: wasmtime::component::Func,
1143
list_u32_ret: wasmtime::component::Func,
1144
list_u64_ret: wasmtime::component::Func,
1145
list_s8_ret: wasmtime::component::Func,
1146
list_s16_ret: wasmtime::component::Func,
1147
list_s32_ret: wasmtime::component::Func,
1148
list_s64_ret: wasmtime::component::Func,
1149
list_f32_ret: wasmtime::component::Func,
1150
list_f64_ret: wasmtime::component::Func,
1151
tuple_list: wasmtime::component::Func,
1152
string_list_arg: wasmtime::component::Func,
1153
string_list_ret: wasmtime::component::Func,
1154
tuple_string_list: wasmtime::component::Func,
1155
string_list: wasmtime::component::Func,
1156
record_list: wasmtime::component::Func,
1157
record_list_reverse: wasmtime::component::Func,
1158
variant_list: wasmtime::component::Func,
1159
load_store_everything: wasmtime::component::Func,
1160
}
1161
#[derive(Clone)]
1162
pub struct GuestIndices {
1163
list_u8_param: wasmtime::component::ComponentExportIndex,
1164
list_u16_param: wasmtime::component::ComponentExportIndex,
1165
list_u32_param: wasmtime::component::ComponentExportIndex,
1166
list_u64_param: wasmtime::component::ComponentExportIndex,
1167
list_s8_param: wasmtime::component::ComponentExportIndex,
1168
list_s16_param: wasmtime::component::ComponentExportIndex,
1169
list_s32_param: wasmtime::component::ComponentExportIndex,
1170
list_s64_param: wasmtime::component::ComponentExportIndex,
1171
list_f32_param: wasmtime::component::ComponentExportIndex,
1172
list_f64_param: wasmtime::component::ComponentExportIndex,
1173
list_u8_ret: wasmtime::component::ComponentExportIndex,
1174
list_u16_ret: wasmtime::component::ComponentExportIndex,
1175
list_u32_ret: wasmtime::component::ComponentExportIndex,
1176
list_u64_ret: wasmtime::component::ComponentExportIndex,
1177
list_s8_ret: wasmtime::component::ComponentExportIndex,
1178
list_s16_ret: wasmtime::component::ComponentExportIndex,
1179
list_s32_ret: wasmtime::component::ComponentExportIndex,
1180
list_s64_ret: wasmtime::component::ComponentExportIndex,
1181
list_f32_ret: wasmtime::component::ComponentExportIndex,
1182
list_f64_ret: wasmtime::component::ComponentExportIndex,
1183
tuple_list: wasmtime::component::ComponentExportIndex,
1184
string_list_arg: wasmtime::component::ComponentExportIndex,
1185
string_list_ret: wasmtime::component::ComponentExportIndex,
1186
tuple_string_list: wasmtime::component::ComponentExportIndex,
1187
string_list: wasmtime::component::ComponentExportIndex,
1188
record_list: wasmtime::component::ComponentExportIndex,
1189
record_list_reverse: wasmtime::component::ComponentExportIndex,
1190
variant_list: wasmtime::component::ComponentExportIndex,
1191
load_store_everything: wasmtime::component::ComponentExportIndex,
1192
}
1193
impl GuestIndices {
1194
/// Constructor for [`GuestIndices`] which takes a
1195
/// [`Component`](wasmtime::component::Component) as input and can be executed
1196
/// before instantiation.
1197
///
1198
/// This constructor can be used to front-load string lookups to find exports
1199
/// within a component.
1200
pub fn new<_T>(
1201
_instance_pre: &wasmtime::component::InstancePre<_T>,
1202
) -> wasmtime::Result<GuestIndices> {
1203
let instance = _instance_pre
1204
.component()
1205
.get_export_index(None, "foo:foo/lists")
1206
.ok_or_else(|| {
1207
anyhow::anyhow!(
1208
"no exported instance named `foo:foo/lists`"
1209
)
1210
})?;
1211
let mut lookup = move |name| {
1212
_instance_pre
1213
.component()
1214
.get_export_index(Some(&instance), name)
1215
.ok_or_else(|| {
1216
anyhow::anyhow!(
1217
"instance export `foo:foo/lists` does \
1218
not have export `{name}`"
1219
)
1220
})
1221
};
1222
let _ = &mut lookup;
1223
let list_u8_param = lookup("list-u8-param")?;
1224
let list_u16_param = lookup("list-u16-param")?;
1225
let list_u32_param = lookup("list-u32-param")?;
1226
let list_u64_param = lookup("list-u64-param")?;
1227
let list_s8_param = lookup("list-s8-param")?;
1228
let list_s16_param = lookup("list-s16-param")?;
1229
let list_s32_param = lookup("list-s32-param")?;
1230
let list_s64_param = lookup("list-s64-param")?;
1231
let list_f32_param = lookup("list-f32-param")?;
1232
let list_f64_param = lookup("list-f64-param")?;
1233
let list_u8_ret = lookup("list-u8-ret")?;
1234
let list_u16_ret = lookup("list-u16-ret")?;
1235
let list_u32_ret = lookup("list-u32-ret")?;
1236
let list_u64_ret = lookup("list-u64-ret")?;
1237
let list_s8_ret = lookup("list-s8-ret")?;
1238
let list_s16_ret = lookup("list-s16-ret")?;
1239
let list_s32_ret = lookup("list-s32-ret")?;
1240
let list_s64_ret = lookup("list-s64-ret")?;
1241
let list_f32_ret = lookup("list-f32-ret")?;
1242
let list_f64_ret = lookup("list-f64-ret")?;
1243
let tuple_list = lookup("tuple-list")?;
1244
let string_list_arg = lookup("string-list-arg")?;
1245
let string_list_ret = lookup("string-list-ret")?;
1246
let tuple_string_list = lookup("tuple-string-list")?;
1247
let string_list = lookup("string-list")?;
1248
let record_list = lookup("record-list")?;
1249
let record_list_reverse = lookup("record-list-reverse")?;
1250
let variant_list = lookup("variant-list")?;
1251
let load_store_everything = lookup("load-store-everything")?;
1252
Ok(GuestIndices {
1253
list_u8_param,
1254
list_u16_param,
1255
list_u32_param,
1256
list_u64_param,
1257
list_s8_param,
1258
list_s16_param,
1259
list_s32_param,
1260
list_s64_param,
1261
list_f32_param,
1262
list_f64_param,
1263
list_u8_ret,
1264
list_u16_ret,
1265
list_u32_ret,
1266
list_u64_ret,
1267
list_s8_ret,
1268
list_s16_ret,
1269
list_s32_ret,
1270
list_s64_ret,
1271
list_f32_ret,
1272
list_f64_ret,
1273
tuple_list,
1274
string_list_arg,
1275
string_list_ret,
1276
tuple_string_list,
1277
string_list,
1278
record_list,
1279
record_list_reverse,
1280
variant_list,
1281
load_store_everything,
1282
})
1283
}
1284
pub fn load(
1285
&self,
1286
mut store: impl wasmtime::AsContextMut,
1287
instance: &wasmtime::component::Instance,
1288
) -> wasmtime::Result<Guest> {
1289
let _instance = instance;
1290
let _instance_pre = _instance.instance_pre(&store);
1291
let _instance_type = _instance_pre.instance_type();
1292
let mut store = store.as_context_mut();
1293
let _ = &mut store;
1294
let list_u8_param = *_instance
1295
.get_typed_func::<
1296
(&[u8],),
1297
(),
1298
>(&mut store, &self.list_u8_param)?
1299
.func();
1300
let list_u16_param = *_instance
1301
.get_typed_func::<
1302
(&[u16],),
1303
(),
1304
>(&mut store, &self.list_u16_param)?
1305
.func();
1306
let list_u32_param = *_instance
1307
.get_typed_func::<
1308
(&[u32],),
1309
(),
1310
>(&mut store, &self.list_u32_param)?
1311
.func();
1312
let list_u64_param = *_instance
1313
.get_typed_func::<
1314
(&[u64],),
1315
(),
1316
>(&mut store, &self.list_u64_param)?
1317
.func();
1318
let list_s8_param = *_instance
1319
.get_typed_func::<
1320
(&[i8],),
1321
(),
1322
>(&mut store, &self.list_s8_param)?
1323
.func();
1324
let list_s16_param = *_instance
1325
.get_typed_func::<
1326
(&[i16],),
1327
(),
1328
>(&mut store, &self.list_s16_param)?
1329
.func();
1330
let list_s32_param = *_instance
1331
.get_typed_func::<
1332
(&[i32],),
1333
(),
1334
>(&mut store, &self.list_s32_param)?
1335
.func();
1336
let list_s64_param = *_instance
1337
.get_typed_func::<
1338
(&[i64],),
1339
(),
1340
>(&mut store, &self.list_s64_param)?
1341
.func();
1342
let list_f32_param = *_instance
1343
.get_typed_func::<
1344
(&[f32],),
1345
(),
1346
>(&mut store, &self.list_f32_param)?
1347
.func();
1348
let list_f64_param = *_instance
1349
.get_typed_func::<
1350
(&[f64],),
1351
(),
1352
>(&mut store, &self.list_f64_param)?
1353
.func();
1354
let list_u8_ret = *_instance
1355
.get_typed_func::<
1356
(),
1357
(wasmtime::component::__internal::Vec<u8>,),
1358
>(&mut store, &self.list_u8_ret)?
1359
.func();
1360
let list_u16_ret = *_instance
1361
.get_typed_func::<
1362
(),
1363
(wasmtime::component::__internal::Vec<u16>,),
1364
>(&mut store, &self.list_u16_ret)?
1365
.func();
1366
let list_u32_ret = *_instance
1367
.get_typed_func::<
1368
(),
1369
(wasmtime::component::__internal::Vec<u32>,),
1370
>(&mut store, &self.list_u32_ret)?
1371
.func();
1372
let list_u64_ret = *_instance
1373
.get_typed_func::<
1374
(),
1375
(wasmtime::component::__internal::Vec<u64>,),
1376
>(&mut store, &self.list_u64_ret)?
1377
.func();
1378
let list_s8_ret = *_instance
1379
.get_typed_func::<
1380
(),
1381
(wasmtime::component::__internal::Vec<i8>,),
1382
>(&mut store, &self.list_s8_ret)?
1383
.func();
1384
let list_s16_ret = *_instance
1385
.get_typed_func::<
1386
(),
1387
(wasmtime::component::__internal::Vec<i16>,),
1388
>(&mut store, &self.list_s16_ret)?
1389
.func();
1390
let list_s32_ret = *_instance
1391
.get_typed_func::<
1392
(),
1393
(wasmtime::component::__internal::Vec<i32>,),
1394
>(&mut store, &self.list_s32_ret)?
1395
.func();
1396
let list_s64_ret = *_instance
1397
.get_typed_func::<
1398
(),
1399
(wasmtime::component::__internal::Vec<i64>,),
1400
>(&mut store, &self.list_s64_ret)?
1401
.func();
1402
let list_f32_ret = *_instance
1403
.get_typed_func::<
1404
(),
1405
(wasmtime::component::__internal::Vec<f32>,),
1406
>(&mut store, &self.list_f32_ret)?
1407
.func();
1408
let list_f64_ret = *_instance
1409
.get_typed_func::<
1410
(),
1411
(wasmtime::component::__internal::Vec<f64>,),
1412
>(&mut store, &self.list_f64_ret)?
1413
.func();
1414
let tuple_list = *_instance
1415
.get_typed_func::<
1416
(&[(u8, i8)],),
1417
(wasmtime::component::__internal::Vec<(i64, u32)>,),
1418
>(&mut store, &self.tuple_list)?
1419
.func();
1420
let string_list_arg = *_instance
1421
.get_typed_func::<
1422
(&[wasmtime::component::__internal::String],),
1423
(),
1424
>(&mut store, &self.string_list_arg)?
1425
.func();
1426
let string_list_ret = *_instance
1427
.get_typed_func::<
1428
(),
1429
(
1430
wasmtime::component::__internal::Vec<
1431
wasmtime::component::__internal::String,
1432
>,
1433
),
1434
>(&mut store, &self.string_list_ret)?
1435
.func();
1436
let tuple_string_list = *_instance
1437
.get_typed_func::<
1438
(&[(u8, wasmtime::component::__internal::String)],),
1439
(
1440
wasmtime::component::__internal::Vec<
1441
(wasmtime::component::__internal::String, u8),
1442
>,
1443
),
1444
>(&mut store, &self.tuple_string_list)?
1445
.func();
1446
let string_list = *_instance
1447
.get_typed_func::<
1448
(&[wasmtime::component::__internal::String],),
1449
(
1450
wasmtime::component::__internal::Vec<
1451
wasmtime::component::__internal::String,
1452
>,
1453
),
1454
>(&mut store, &self.string_list)?
1455
.func();
1456
let record_list = *_instance
1457
.get_typed_func::<
1458
(&[SomeRecord],),
1459
(wasmtime::component::__internal::Vec<OtherRecord>,),
1460
>(&mut store, &self.record_list)?
1461
.func();
1462
let record_list_reverse = *_instance
1463
.get_typed_func::<
1464
(&[OtherRecord],),
1465
(wasmtime::component::__internal::Vec<SomeRecord>,),
1466
>(&mut store, &self.record_list_reverse)?
1467
.func();
1468
let variant_list = *_instance
1469
.get_typed_func::<
1470
(&[SomeVariant],),
1471
(wasmtime::component::__internal::Vec<OtherVariant>,),
1472
>(&mut store, &self.variant_list)?
1473
.func();
1474
let load_store_everything = *_instance
1475
.get_typed_func::<
1476
(&LoadStoreAllSizes,),
1477
(LoadStoreAllSizes,),
1478
>(&mut store, &self.load_store_everything)?
1479
.func();
1480
Ok(Guest {
1481
list_u8_param,
1482
list_u16_param,
1483
list_u32_param,
1484
list_u64_param,
1485
list_s8_param,
1486
list_s16_param,
1487
list_s32_param,
1488
list_s64_param,
1489
list_f32_param,
1490
list_f64_param,
1491
list_u8_ret,
1492
list_u16_ret,
1493
list_u32_ret,
1494
list_u64_ret,
1495
list_s8_ret,
1496
list_s16_ret,
1497
list_s32_ret,
1498
list_s64_ret,
1499
list_f32_ret,
1500
list_f64_ret,
1501
tuple_list,
1502
string_list_arg,
1503
string_list_ret,
1504
tuple_string_list,
1505
string_list,
1506
record_list,
1507
record_list_reverse,
1508
variant_list,
1509
load_store_everything,
1510
})
1511
}
1512
}
1513
impl Guest {
1514
pub async fn call_list_u8_param<_T, _D>(
1515
&self,
1516
accessor: &wasmtime::component::Accessor<_T, _D>,
1517
arg0: wasmtime::component::__internal::Vec<u8>,
1518
) -> wasmtime::Result<()>
1519
where
1520
_T: Send,
1521
_D: wasmtime::component::HasData,
1522
{
1523
let callee = unsafe {
1524
wasmtime::component::TypedFunc::<
1525
(wasmtime::component::__internal::Vec<u8>,),
1526
(),
1527
>::new_unchecked(self.list_u8_param)
1528
};
1529
let () = callee.call_concurrent(accessor, (arg0,)).await?;
1530
Ok(())
1531
}
1532
pub async fn call_list_u16_param<_T, _D>(
1533
&self,
1534
accessor: &wasmtime::component::Accessor<_T, _D>,
1535
arg0: wasmtime::component::__internal::Vec<u16>,
1536
) -> wasmtime::Result<()>
1537
where
1538
_T: Send,
1539
_D: wasmtime::component::HasData,
1540
{
1541
let callee = unsafe {
1542
wasmtime::component::TypedFunc::<
1543
(wasmtime::component::__internal::Vec<u16>,),
1544
(),
1545
>::new_unchecked(self.list_u16_param)
1546
};
1547
let () = callee.call_concurrent(accessor, (arg0,)).await?;
1548
Ok(())
1549
}
1550
pub async fn call_list_u32_param<_T, _D>(
1551
&self,
1552
accessor: &wasmtime::component::Accessor<_T, _D>,
1553
arg0: wasmtime::component::__internal::Vec<u32>,
1554
) -> wasmtime::Result<()>
1555
where
1556
_T: Send,
1557
_D: wasmtime::component::HasData,
1558
{
1559
let callee = unsafe {
1560
wasmtime::component::TypedFunc::<
1561
(wasmtime::component::__internal::Vec<u32>,),
1562
(),
1563
>::new_unchecked(self.list_u32_param)
1564
};
1565
let () = callee.call_concurrent(accessor, (arg0,)).await?;
1566
Ok(())
1567
}
1568
pub async fn call_list_u64_param<_T, _D>(
1569
&self,
1570
accessor: &wasmtime::component::Accessor<_T, _D>,
1571
arg0: wasmtime::component::__internal::Vec<u64>,
1572
) -> wasmtime::Result<()>
1573
where
1574
_T: Send,
1575
_D: wasmtime::component::HasData,
1576
{
1577
let callee = unsafe {
1578
wasmtime::component::TypedFunc::<
1579
(wasmtime::component::__internal::Vec<u64>,),
1580
(),
1581
>::new_unchecked(self.list_u64_param)
1582
};
1583
let () = callee.call_concurrent(accessor, (arg0,)).await?;
1584
Ok(())
1585
}
1586
pub async fn call_list_s8_param<_T, _D>(
1587
&self,
1588
accessor: &wasmtime::component::Accessor<_T, _D>,
1589
arg0: wasmtime::component::__internal::Vec<i8>,
1590
) -> wasmtime::Result<()>
1591
where
1592
_T: Send,
1593
_D: wasmtime::component::HasData,
1594
{
1595
let callee = unsafe {
1596
wasmtime::component::TypedFunc::<
1597
(wasmtime::component::__internal::Vec<i8>,),
1598
(),
1599
>::new_unchecked(self.list_s8_param)
1600
};
1601
let () = callee.call_concurrent(accessor, (arg0,)).await?;
1602
Ok(())
1603
}
1604
pub async fn call_list_s16_param<_T, _D>(
1605
&self,
1606
accessor: &wasmtime::component::Accessor<_T, _D>,
1607
arg0: wasmtime::component::__internal::Vec<i16>,
1608
) -> wasmtime::Result<()>
1609
where
1610
_T: Send,
1611
_D: wasmtime::component::HasData,
1612
{
1613
let callee = unsafe {
1614
wasmtime::component::TypedFunc::<
1615
(wasmtime::component::__internal::Vec<i16>,),
1616
(),
1617
>::new_unchecked(self.list_s16_param)
1618
};
1619
let () = callee.call_concurrent(accessor, (arg0,)).await?;
1620
Ok(())
1621
}
1622
pub async fn call_list_s32_param<_T, _D>(
1623
&self,
1624
accessor: &wasmtime::component::Accessor<_T, _D>,
1625
arg0: wasmtime::component::__internal::Vec<i32>,
1626
) -> wasmtime::Result<()>
1627
where
1628
_T: Send,
1629
_D: wasmtime::component::HasData,
1630
{
1631
let callee = unsafe {
1632
wasmtime::component::TypedFunc::<
1633
(wasmtime::component::__internal::Vec<i32>,),
1634
(),
1635
>::new_unchecked(self.list_s32_param)
1636
};
1637
let () = callee.call_concurrent(accessor, (arg0,)).await?;
1638
Ok(())
1639
}
1640
pub async fn call_list_s64_param<_T, _D>(
1641
&self,
1642
accessor: &wasmtime::component::Accessor<_T, _D>,
1643
arg0: wasmtime::component::__internal::Vec<i64>,
1644
) -> wasmtime::Result<()>
1645
where
1646
_T: Send,
1647
_D: wasmtime::component::HasData,
1648
{
1649
let callee = unsafe {
1650
wasmtime::component::TypedFunc::<
1651
(wasmtime::component::__internal::Vec<i64>,),
1652
(),
1653
>::new_unchecked(self.list_s64_param)
1654
};
1655
let () = callee.call_concurrent(accessor, (arg0,)).await?;
1656
Ok(())
1657
}
1658
pub async fn call_list_f32_param<_T, _D>(
1659
&self,
1660
accessor: &wasmtime::component::Accessor<_T, _D>,
1661
arg0: wasmtime::component::__internal::Vec<f32>,
1662
) -> wasmtime::Result<()>
1663
where
1664
_T: Send,
1665
_D: wasmtime::component::HasData,
1666
{
1667
let callee = unsafe {
1668
wasmtime::component::TypedFunc::<
1669
(wasmtime::component::__internal::Vec<f32>,),
1670
(),
1671
>::new_unchecked(self.list_f32_param)
1672
};
1673
let () = callee.call_concurrent(accessor, (arg0,)).await?;
1674
Ok(())
1675
}
1676
pub async fn call_list_f64_param<_T, _D>(
1677
&self,
1678
accessor: &wasmtime::component::Accessor<_T, _D>,
1679
arg0: wasmtime::component::__internal::Vec<f64>,
1680
) -> wasmtime::Result<()>
1681
where
1682
_T: Send,
1683
_D: wasmtime::component::HasData,
1684
{
1685
let callee = unsafe {
1686
wasmtime::component::TypedFunc::<
1687
(wasmtime::component::__internal::Vec<f64>,),
1688
(),
1689
>::new_unchecked(self.list_f64_param)
1690
};
1691
let () = callee.call_concurrent(accessor, (arg0,)).await?;
1692
Ok(())
1693
}
1694
pub async fn call_list_u8_ret<_T, _D>(
1695
&self,
1696
accessor: &wasmtime::component::Accessor<_T, _D>,
1697
) -> wasmtime::Result<wasmtime::component::__internal::Vec<u8>>
1698
where
1699
_T: Send,
1700
_D: wasmtime::component::HasData,
1701
{
1702
let callee = unsafe {
1703
wasmtime::component::TypedFunc::<
1704
(),
1705
(wasmtime::component::__internal::Vec<u8>,),
1706
>::new_unchecked(self.list_u8_ret)
1707
};
1708
let (ret0,) = callee.call_concurrent(accessor, ()).await?;
1709
Ok(ret0)
1710
}
1711
pub async fn call_list_u16_ret<_T, _D>(
1712
&self,
1713
accessor: &wasmtime::component::Accessor<_T, _D>,
1714
) -> wasmtime::Result<wasmtime::component::__internal::Vec<u16>>
1715
where
1716
_T: Send,
1717
_D: wasmtime::component::HasData,
1718
{
1719
let callee = unsafe {
1720
wasmtime::component::TypedFunc::<
1721
(),
1722
(wasmtime::component::__internal::Vec<u16>,),
1723
>::new_unchecked(self.list_u16_ret)
1724
};
1725
let (ret0,) = callee.call_concurrent(accessor, ()).await?;
1726
Ok(ret0)
1727
}
1728
pub async fn call_list_u32_ret<_T, _D>(
1729
&self,
1730
accessor: &wasmtime::component::Accessor<_T, _D>,
1731
) -> wasmtime::Result<wasmtime::component::__internal::Vec<u32>>
1732
where
1733
_T: Send,
1734
_D: wasmtime::component::HasData,
1735
{
1736
let callee = unsafe {
1737
wasmtime::component::TypedFunc::<
1738
(),
1739
(wasmtime::component::__internal::Vec<u32>,),
1740
>::new_unchecked(self.list_u32_ret)
1741
};
1742
let (ret0,) = callee.call_concurrent(accessor, ()).await?;
1743
Ok(ret0)
1744
}
1745
pub async fn call_list_u64_ret<_T, _D>(
1746
&self,
1747
accessor: &wasmtime::component::Accessor<_T, _D>,
1748
) -> wasmtime::Result<wasmtime::component::__internal::Vec<u64>>
1749
where
1750
_T: Send,
1751
_D: wasmtime::component::HasData,
1752
{
1753
let callee = unsafe {
1754
wasmtime::component::TypedFunc::<
1755
(),
1756
(wasmtime::component::__internal::Vec<u64>,),
1757
>::new_unchecked(self.list_u64_ret)
1758
};
1759
let (ret0,) = callee.call_concurrent(accessor, ()).await?;
1760
Ok(ret0)
1761
}
1762
pub async fn call_list_s8_ret<_T, _D>(
1763
&self,
1764
accessor: &wasmtime::component::Accessor<_T, _D>,
1765
) -> wasmtime::Result<wasmtime::component::__internal::Vec<i8>>
1766
where
1767
_T: Send,
1768
_D: wasmtime::component::HasData,
1769
{
1770
let callee = unsafe {
1771
wasmtime::component::TypedFunc::<
1772
(),
1773
(wasmtime::component::__internal::Vec<i8>,),
1774
>::new_unchecked(self.list_s8_ret)
1775
};
1776
let (ret0,) = callee.call_concurrent(accessor, ()).await?;
1777
Ok(ret0)
1778
}
1779
pub async fn call_list_s16_ret<_T, _D>(
1780
&self,
1781
accessor: &wasmtime::component::Accessor<_T, _D>,
1782
) -> wasmtime::Result<wasmtime::component::__internal::Vec<i16>>
1783
where
1784
_T: Send,
1785
_D: wasmtime::component::HasData,
1786
{
1787
let callee = unsafe {
1788
wasmtime::component::TypedFunc::<
1789
(),
1790
(wasmtime::component::__internal::Vec<i16>,),
1791
>::new_unchecked(self.list_s16_ret)
1792
};
1793
let (ret0,) = callee.call_concurrent(accessor, ()).await?;
1794
Ok(ret0)
1795
}
1796
pub async fn call_list_s32_ret<_T, _D>(
1797
&self,
1798
accessor: &wasmtime::component::Accessor<_T, _D>,
1799
) -> wasmtime::Result<wasmtime::component::__internal::Vec<i32>>
1800
where
1801
_T: Send,
1802
_D: wasmtime::component::HasData,
1803
{
1804
let callee = unsafe {
1805
wasmtime::component::TypedFunc::<
1806
(),
1807
(wasmtime::component::__internal::Vec<i32>,),
1808
>::new_unchecked(self.list_s32_ret)
1809
};
1810
let (ret0,) = callee.call_concurrent(accessor, ()).await?;
1811
Ok(ret0)
1812
}
1813
pub async fn call_list_s64_ret<_T, _D>(
1814
&self,
1815
accessor: &wasmtime::component::Accessor<_T, _D>,
1816
) -> wasmtime::Result<wasmtime::component::__internal::Vec<i64>>
1817
where
1818
_T: Send,
1819
_D: wasmtime::component::HasData,
1820
{
1821
let callee = unsafe {
1822
wasmtime::component::TypedFunc::<
1823
(),
1824
(wasmtime::component::__internal::Vec<i64>,),
1825
>::new_unchecked(self.list_s64_ret)
1826
};
1827
let (ret0,) = callee.call_concurrent(accessor, ()).await?;
1828
Ok(ret0)
1829
}
1830
pub async fn call_list_f32_ret<_T, _D>(
1831
&self,
1832
accessor: &wasmtime::component::Accessor<_T, _D>,
1833
) -> wasmtime::Result<wasmtime::component::__internal::Vec<f32>>
1834
where
1835
_T: Send,
1836
_D: wasmtime::component::HasData,
1837
{
1838
let callee = unsafe {
1839
wasmtime::component::TypedFunc::<
1840
(),
1841
(wasmtime::component::__internal::Vec<f32>,),
1842
>::new_unchecked(self.list_f32_ret)
1843
};
1844
let (ret0,) = callee.call_concurrent(accessor, ()).await?;
1845
Ok(ret0)
1846
}
1847
pub async fn call_list_f64_ret<_T, _D>(
1848
&self,
1849
accessor: &wasmtime::component::Accessor<_T, _D>,
1850
) -> wasmtime::Result<wasmtime::component::__internal::Vec<f64>>
1851
where
1852
_T: Send,
1853
_D: wasmtime::component::HasData,
1854
{
1855
let callee = unsafe {
1856
wasmtime::component::TypedFunc::<
1857
(),
1858
(wasmtime::component::__internal::Vec<f64>,),
1859
>::new_unchecked(self.list_f64_ret)
1860
};
1861
let (ret0,) = callee.call_concurrent(accessor, ()).await?;
1862
Ok(ret0)
1863
}
1864
pub async fn call_tuple_list<_T, _D>(
1865
&self,
1866
accessor: &wasmtime::component::Accessor<_T, _D>,
1867
arg0: wasmtime::component::__internal::Vec<(u8, i8)>,
1868
) -> wasmtime::Result<
1869
wasmtime::component::__internal::Vec<(i64, u32)>,
1870
>
1871
where
1872
_T: Send,
1873
_D: wasmtime::component::HasData,
1874
{
1875
let callee = unsafe {
1876
wasmtime::component::TypedFunc::<
1877
(wasmtime::component::__internal::Vec<(u8, i8)>,),
1878
(wasmtime::component::__internal::Vec<(i64, u32)>,),
1879
>::new_unchecked(self.tuple_list)
1880
};
1881
let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
1882
Ok(ret0)
1883
}
1884
pub async fn call_string_list_arg<_T, _D>(
1885
&self,
1886
accessor: &wasmtime::component::Accessor<_T, _D>,
1887
arg0: wasmtime::component::__internal::Vec<
1888
wasmtime::component::__internal::String,
1889
>,
1890
) -> wasmtime::Result<()>
1891
where
1892
_T: Send,
1893
_D: wasmtime::component::HasData,
1894
{
1895
let callee = unsafe {
1896
wasmtime::component::TypedFunc::<
1897
(
1898
wasmtime::component::__internal::Vec<
1899
wasmtime::component::__internal::String,
1900
>,
1901
),
1902
(),
1903
>::new_unchecked(self.string_list_arg)
1904
};
1905
let () = callee.call_concurrent(accessor, (arg0,)).await?;
1906
Ok(())
1907
}
1908
pub async fn call_string_list_ret<_T, _D>(
1909
&self,
1910
accessor: &wasmtime::component::Accessor<_T, _D>,
1911
) -> wasmtime::Result<
1912
wasmtime::component::__internal::Vec<
1913
wasmtime::component::__internal::String,
1914
>,
1915
>
1916
where
1917
_T: Send,
1918
_D: wasmtime::component::HasData,
1919
{
1920
let callee = unsafe {
1921
wasmtime::component::TypedFunc::<
1922
(),
1923
(
1924
wasmtime::component::__internal::Vec<
1925
wasmtime::component::__internal::String,
1926
>,
1927
),
1928
>::new_unchecked(self.string_list_ret)
1929
};
1930
let (ret0,) = callee.call_concurrent(accessor, ()).await?;
1931
Ok(ret0)
1932
}
1933
pub async fn call_tuple_string_list<_T, _D>(
1934
&self,
1935
accessor: &wasmtime::component::Accessor<_T, _D>,
1936
arg0: wasmtime::component::__internal::Vec<
1937
(u8, wasmtime::component::__internal::String),
1938
>,
1939
) -> wasmtime::Result<
1940
wasmtime::component::__internal::Vec<
1941
(wasmtime::component::__internal::String, u8),
1942
>,
1943
>
1944
where
1945
_T: Send,
1946
_D: wasmtime::component::HasData,
1947
{
1948
let callee = unsafe {
1949
wasmtime::component::TypedFunc::<
1950
(
1951
wasmtime::component::__internal::Vec<
1952
(u8, wasmtime::component::__internal::String),
1953
>,
1954
),
1955
(
1956
wasmtime::component::__internal::Vec<
1957
(wasmtime::component::__internal::String, u8),
1958
>,
1959
),
1960
>::new_unchecked(self.tuple_string_list)
1961
};
1962
let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
1963
Ok(ret0)
1964
}
1965
pub async fn call_string_list<_T, _D>(
1966
&self,
1967
accessor: &wasmtime::component::Accessor<_T, _D>,
1968
arg0: wasmtime::component::__internal::Vec<
1969
wasmtime::component::__internal::String,
1970
>,
1971
) -> wasmtime::Result<
1972
wasmtime::component::__internal::Vec<
1973
wasmtime::component::__internal::String,
1974
>,
1975
>
1976
where
1977
_T: Send,
1978
_D: wasmtime::component::HasData,
1979
{
1980
let callee = unsafe {
1981
wasmtime::component::TypedFunc::<
1982
(
1983
wasmtime::component::__internal::Vec<
1984
wasmtime::component::__internal::String,
1985
>,
1986
),
1987
(
1988
wasmtime::component::__internal::Vec<
1989
wasmtime::component::__internal::String,
1990
>,
1991
),
1992
>::new_unchecked(self.string_list)
1993
};
1994
let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
1995
Ok(ret0)
1996
}
1997
pub async fn call_record_list<_T, _D>(
1998
&self,
1999
accessor: &wasmtime::component::Accessor<_T, _D>,
2000
arg0: wasmtime::component::__internal::Vec<SomeRecord>,
2001
) -> wasmtime::Result<
2002
wasmtime::component::__internal::Vec<OtherRecord>,
2003
>
2004
where
2005
_T: Send,
2006
_D: wasmtime::component::HasData,
2007
{
2008
let callee = unsafe {
2009
wasmtime::component::TypedFunc::<
2010
(wasmtime::component::__internal::Vec<SomeRecord>,),
2011
(wasmtime::component::__internal::Vec<OtherRecord>,),
2012
>::new_unchecked(self.record_list)
2013
};
2014
let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
2015
Ok(ret0)
2016
}
2017
pub async fn call_record_list_reverse<_T, _D>(
2018
&self,
2019
accessor: &wasmtime::component::Accessor<_T, _D>,
2020
arg0: wasmtime::component::__internal::Vec<OtherRecord>,
2021
) -> wasmtime::Result<
2022
wasmtime::component::__internal::Vec<SomeRecord>,
2023
>
2024
where
2025
_T: Send,
2026
_D: wasmtime::component::HasData,
2027
{
2028
let callee = unsafe {
2029
wasmtime::component::TypedFunc::<
2030
(wasmtime::component::__internal::Vec<OtherRecord>,),
2031
(wasmtime::component::__internal::Vec<SomeRecord>,),
2032
>::new_unchecked(self.record_list_reverse)
2033
};
2034
let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
2035
Ok(ret0)
2036
}
2037
pub async fn call_variant_list<_T, _D>(
2038
&self,
2039
accessor: &wasmtime::component::Accessor<_T, _D>,
2040
arg0: wasmtime::component::__internal::Vec<SomeVariant>,
2041
) -> wasmtime::Result<
2042
wasmtime::component::__internal::Vec<OtherVariant>,
2043
>
2044
where
2045
_T: Send,
2046
_D: wasmtime::component::HasData,
2047
{
2048
let callee = unsafe {
2049
wasmtime::component::TypedFunc::<
2050
(wasmtime::component::__internal::Vec<SomeVariant>,),
2051
(wasmtime::component::__internal::Vec<OtherVariant>,),
2052
>::new_unchecked(self.variant_list)
2053
};
2054
let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
2055
Ok(ret0)
2056
}
2057
pub async fn call_load_store_everything<_T, _D>(
2058
&self,
2059
accessor: &wasmtime::component::Accessor<_T, _D>,
2060
arg0: LoadStoreAllSizes,
2061
) -> wasmtime::Result<LoadStoreAllSizes>
2062
where
2063
_T: Send,
2064
_D: wasmtime::component::HasData,
2065
{
2066
let callee = unsafe {
2067
wasmtime::component::TypedFunc::<
2068
(LoadStoreAllSizes,),
2069
(LoadStoreAllSizes,),
2070
>::new_unchecked(self.load_store_everything)
2071
};
2072
let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
2073
Ok(ret0)
2074
}
2075
}
2076
}
2077
}
2078
}
2079
}
2080
2081