Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/component-macro/tests/expanded/integers.rs
1692 views
1
/// Auto-generated bindings for a pre-instantiated version of a
2
/// component which implements the world `the-world`.
3
///
4
/// This structure is created through [`TheWorldPre::new`] which
5
/// takes a [`InstancePre`](wasmtime::component::InstancePre) that
6
/// has been created through a [`Linker`](wasmtime::component::Linker).
7
///
8
/// For more information see [`TheWorld`] as well.
9
pub struct TheWorldPre<T: 'static> {
10
instance_pre: wasmtime::component::InstancePre<T>,
11
indices: TheWorldIndices,
12
}
13
impl<T: 'static> Clone for TheWorldPre<T> {
14
fn clone(&self) -> Self {
15
Self {
16
instance_pre: self.instance_pre.clone(),
17
indices: self.indices.clone(),
18
}
19
}
20
}
21
impl<_T: 'static> TheWorldPre<_T> {
22
/// Creates a new copy of `TheWorldPre` bindings which can then
23
/// be used to instantiate into a particular store.
24
///
25
/// This method may fail if the component behind `instance_pre`
26
/// does not have the required exports.
27
pub fn new(
28
instance_pre: wasmtime::component::InstancePre<_T>,
29
) -> wasmtime::Result<Self> {
30
let indices = TheWorldIndices::new(&instance_pre)?;
31
Ok(Self { instance_pre, indices })
32
}
33
pub fn engine(&self) -> &wasmtime::Engine {
34
self.instance_pre.engine()
35
}
36
pub fn instance_pre(&self) -> &wasmtime::component::InstancePre<_T> {
37
&self.instance_pre
38
}
39
/// Instantiates a new instance of [`TheWorld`] within the
40
/// `store` provided.
41
///
42
/// This function will use `self` as the pre-instantiated
43
/// instance to perform instantiation. Afterwards the preloaded
44
/// indices in `self` are used to lookup all exports on the
45
/// resulting instance.
46
pub fn instantiate(
47
&self,
48
mut store: impl wasmtime::AsContextMut<Data = _T>,
49
) -> wasmtime::Result<TheWorld> {
50
let mut store = store.as_context_mut();
51
let instance = self.instance_pre.instantiate(&mut store)?;
52
self.indices.load(&mut store, &instance)
53
}
54
}
55
impl<_T: Send + 'static> TheWorldPre<_T> {
56
/// Same as [`Self::instantiate`], except with `async`.
57
pub async fn instantiate_async(
58
&self,
59
mut store: impl wasmtime::AsContextMut<Data = _T>,
60
) -> wasmtime::Result<TheWorld> {
61
let mut store = store.as_context_mut();
62
let instance = self.instance_pre.instantiate_async(&mut store).await?;
63
self.indices.load(&mut store, &instance)
64
}
65
}
66
/// Auto-generated bindings for index of the exports of
67
/// `the-world`.
68
///
69
/// This is an implementation detail of [`TheWorldPre`] and can
70
/// be constructed if needed as well.
71
///
72
/// For more information see [`TheWorld`] as well.
73
#[derive(Clone)]
74
pub struct TheWorldIndices {
75
interface0: exports::foo::foo::integers::GuestIndices,
76
}
77
/// Auto-generated bindings for an instance a component which
78
/// implements the world `the-world`.
79
///
80
/// This structure can be created through a number of means
81
/// depending on your requirements and what you have on hand:
82
///
83
/// * The most convenient way is to use
84
/// [`TheWorld::instantiate`] which only needs a
85
/// [`Store`], [`Component`], and [`Linker`].
86
///
87
/// * Alternatively you can create a [`TheWorldPre`] ahead of
88
/// time with a [`Component`] to front-load string lookups
89
/// of exports once instead of per-instantiation. This
90
/// method then uses [`TheWorldPre::instantiate`] to
91
/// create a [`TheWorld`].
92
///
93
/// * If you've instantiated the instance yourself already
94
/// then you can use [`TheWorld::new`].
95
///
96
/// These methods are all equivalent to one another and move
97
/// around the tradeoff of what work is performed when.
98
///
99
/// [`Store`]: wasmtime::Store
100
/// [`Component`]: wasmtime::component::Component
101
/// [`Linker`]: wasmtime::component::Linker
102
pub struct TheWorld {
103
interface0: exports::foo::foo::integers::Guest,
104
}
105
const _: () = {
106
#[allow(unused_imports)]
107
use wasmtime::component::__internal::anyhow;
108
impl TheWorldIndices {
109
/// Creates a new copy of `TheWorldIndices` 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::integers::GuestIndices::new(
120
_instance_pre,
121
)?;
122
Ok(TheWorldIndices { interface0 })
123
}
124
/// Uses the indices stored in `self` to load an instance
125
/// of [`TheWorld`] from the instance provided.
126
///
127
/// Note that at this time this method will additionally
128
/// perform type-checks of all exports.
129
pub fn load(
130
&self,
131
mut store: impl wasmtime::AsContextMut,
132
instance: &wasmtime::component::Instance,
133
) -> wasmtime::Result<TheWorld> {
134
let _ = &mut store;
135
let _instance = instance;
136
let interface0 = self.interface0.load(&mut store, &_instance)?;
137
Ok(TheWorld { interface0 })
138
}
139
}
140
impl TheWorld {
141
/// Convenience wrapper around [`TheWorldPre::new`] and
142
/// [`TheWorldPre::instantiate`].
143
pub fn instantiate<_T>(
144
store: impl wasmtime::AsContextMut<Data = _T>,
145
component: &wasmtime::component::Component,
146
linker: &wasmtime::component::Linker<_T>,
147
) -> wasmtime::Result<TheWorld> {
148
let pre = linker.instantiate_pre(component)?;
149
TheWorldPre::new(pre)?.instantiate(store)
150
}
151
/// Convenience wrapper around [`TheWorldIndices::new`] and
152
/// [`TheWorldIndices::load`].
153
pub fn new(
154
mut store: impl wasmtime::AsContextMut,
155
instance: &wasmtime::component::Instance,
156
) -> wasmtime::Result<TheWorld> {
157
let indices = TheWorldIndices::new(&instance.instance_pre(&store))?;
158
indices.load(&mut store, instance)
159
}
160
/// Convenience wrapper around [`TheWorldPre::new`] and
161
/// [`TheWorldPre::instantiate_async`].
162
pub async fn instantiate_async<_T>(
163
store: impl wasmtime::AsContextMut<Data = _T>,
164
component: &wasmtime::component::Component,
165
linker: &wasmtime::component::Linker<_T>,
166
) -> wasmtime::Result<TheWorld>
167
where
168
_T: Send,
169
{
170
let pre = linker.instantiate_pre(component)?;
171
TheWorldPre::new(pre)?.instantiate_async(store).await
172
}
173
pub fn add_to_linker<T, D>(
174
linker: &mut wasmtime::component::Linker<T>,
175
host_getter: fn(&mut T) -> D::Data<'_>,
176
) -> wasmtime::Result<()>
177
where
178
D: foo::foo::integers::HostWithStore,
179
for<'a> D::Data<'a>: foo::foo::integers::Host,
180
T: 'static,
181
{
182
foo::foo::integers::add_to_linker::<T, D>(linker, host_getter)?;
183
Ok(())
184
}
185
pub fn foo_foo_integers(&self) -> &exports::foo::foo::integers::Guest {
186
&self.interface0
187
}
188
}
189
};
190
pub mod foo {
191
pub mod foo {
192
#[allow(clippy::all)]
193
pub mod integers {
194
#[allow(unused_imports)]
195
use wasmtime::component::__internal::{anyhow, Box};
196
pub trait HostWithStore: wasmtime::component::HasData {}
197
impl<_T: ?Sized> HostWithStore for _T
198
where
199
_T: wasmtime::component::HasData,
200
{}
201
pub trait Host {
202
fn a1(&mut self, x: u8) -> ();
203
fn a2(&mut self, x: i8) -> ();
204
fn a3(&mut self, x: u16) -> ();
205
fn a4(&mut self, x: i16) -> ();
206
fn a5(&mut self, x: u32) -> ();
207
fn a6(&mut self, x: i32) -> ();
208
fn a7(&mut self, x: u64) -> ();
209
fn a8(&mut self, x: i64) -> ();
210
fn a9(
211
&mut self,
212
p1: u8,
213
p2: i8,
214
p3: u16,
215
p4: i16,
216
p5: u32,
217
p6: i32,
218
p7: u64,
219
p8: i64,
220
) -> ();
221
fn r1(&mut self) -> u8;
222
fn r2(&mut self) -> i8;
223
fn r3(&mut self) -> u16;
224
fn r4(&mut self) -> i16;
225
fn r5(&mut self) -> u32;
226
fn r6(&mut self) -> i32;
227
fn r7(&mut self) -> u64;
228
fn r8(&mut self) -> i64;
229
fn pair_ret(&mut self) -> (i64, u8);
230
}
231
impl<_T: Host + ?Sized> Host for &mut _T {
232
fn a1(&mut self, x: u8) -> () {
233
Host::a1(*self, x)
234
}
235
fn a2(&mut self, x: i8) -> () {
236
Host::a2(*self, x)
237
}
238
fn a3(&mut self, x: u16) -> () {
239
Host::a3(*self, x)
240
}
241
fn a4(&mut self, x: i16) -> () {
242
Host::a4(*self, x)
243
}
244
fn a5(&mut self, x: u32) -> () {
245
Host::a5(*self, x)
246
}
247
fn a6(&mut self, x: i32) -> () {
248
Host::a6(*self, x)
249
}
250
fn a7(&mut self, x: u64) -> () {
251
Host::a7(*self, x)
252
}
253
fn a8(&mut self, x: i64) -> () {
254
Host::a8(*self, x)
255
}
256
fn a9(
257
&mut self,
258
p1: u8,
259
p2: i8,
260
p3: u16,
261
p4: i16,
262
p5: u32,
263
p6: i32,
264
p7: u64,
265
p8: i64,
266
) -> () {
267
Host::a9(*self, p1, p2, p3, p4, p5, p6, p7, p8)
268
}
269
fn r1(&mut self) -> u8 {
270
Host::r1(*self)
271
}
272
fn r2(&mut self) -> i8 {
273
Host::r2(*self)
274
}
275
fn r3(&mut self) -> u16 {
276
Host::r3(*self)
277
}
278
fn r4(&mut self) -> i16 {
279
Host::r4(*self)
280
}
281
fn r5(&mut self) -> u32 {
282
Host::r5(*self)
283
}
284
fn r6(&mut self) -> i32 {
285
Host::r6(*self)
286
}
287
fn r7(&mut self) -> u64 {
288
Host::r7(*self)
289
}
290
fn r8(&mut self) -> i64 {
291
Host::r8(*self)
292
}
293
fn pair_ret(&mut self) -> (i64, u8) {
294
Host::pair_ret(*self)
295
}
296
}
297
pub fn add_to_linker<T, D>(
298
linker: &mut wasmtime::component::Linker<T>,
299
host_getter: fn(&mut T) -> D::Data<'_>,
300
) -> wasmtime::Result<()>
301
where
302
D: HostWithStore,
303
for<'a> D::Data<'a>: Host,
304
T: 'static,
305
{
306
let mut inst = linker.instance("foo:foo/integers")?;
307
inst.func_wrap(
308
"a1",
309
move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (u8,)| {
310
let host = &mut host_getter(caller.data_mut());
311
let r = Host::a1(host, arg0);
312
Ok(r)
313
},
314
)?;
315
inst.func_wrap(
316
"a2",
317
move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (i8,)| {
318
let host = &mut host_getter(caller.data_mut());
319
let r = Host::a2(host, arg0);
320
Ok(r)
321
},
322
)?;
323
inst.func_wrap(
324
"a3",
325
move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (u16,)| {
326
let host = &mut host_getter(caller.data_mut());
327
let r = Host::a3(host, arg0);
328
Ok(r)
329
},
330
)?;
331
inst.func_wrap(
332
"a4",
333
move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (i16,)| {
334
let host = &mut host_getter(caller.data_mut());
335
let r = Host::a4(host, arg0);
336
Ok(r)
337
},
338
)?;
339
inst.func_wrap(
340
"a5",
341
move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (u32,)| {
342
let host = &mut host_getter(caller.data_mut());
343
let r = Host::a5(host, arg0);
344
Ok(r)
345
},
346
)?;
347
inst.func_wrap(
348
"a6",
349
move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (i32,)| {
350
let host = &mut host_getter(caller.data_mut());
351
let r = Host::a6(host, arg0);
352
Ok(r)
353
},
354
)?;
355
inst.func_wrap(
356
"a7",
357
move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (u64,)| {
358
let host = &mut host_getter(caller.data_mut());
359
let r = Host::a7(host, arg0);
360
Ok(r)
361
},
362
)?;
363
inst.func_wrap(
364
"a8",
365
move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (i64,)| {
366
let host = &mut host_getter(caller.data_mut());
367
let r = Host::a8(host, arg0);
368
Ok(r)
369
},
370
)?;
371
inst.func_wrap(
372
"a9",
373
move |
374
mut caller: wasmtime::StoreContextMut<'_, T>,
375
(
376
arg0,
377
arg1,
378
arg2,
379
arg3,
380
arg4,
381
arg5,
382
arg6,
383
arg7,
384
): (u8, i8, u16, i16, u32, i32, u64, i64)|
385
{
386
let host = &mut host_getter(caller.data_mut());
387
let r = Host::a9(
388
host,
389
arg0,
390
arg1,
391
arg2,
392
arg3,
393
arg4,
394
arg5,
395
arg6,
396
arg7,
397
);
398
Ok(r)
399
},
400
)?;
401
inst.func_wrap(
402
"r1",
403
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
404
let host = &mut host_getter(caller.data_mut());
405
let r = Host::r1(host);
406
Ok((r,))
407
},
408
)?;
409
inst.func_wrap(
410
"r2",
411
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
412
let host = &mut host_getter(caller.data_mut());
413
let r = Host::r2(host);
414
Ok((r,))
415
},
416
)?;
417
inst.func_wrap(
418
"r3",
419
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
420
let host = &mut host_getter(caller.data_mut());
421
let r = Host::r3(host);
422
Ok((r,))
423
},
424
)?;
425
inst.func_wrap(
426
"r4",
427
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
428
let host = &mut host_getter(caller.data_mut());
429
let r = Host::r4(host);
430
Ok((r,))
431
},
432
)?;
433
inst.func_wrap(
434
"r5",
435
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
436
let host = &mut host_getter(caller.data_mut());
437
let r = Host::r5(host);
438
Ok((r,))
439
},
440
)?;
441
inst.func_wrap(
442
"r6",
443
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
444
let host = &mut host_getter(caller.data_mut());
445
let r = Host::r6(host);
446
Ok((r,))
447
},
448
)?;
449
inst.func_wrap(
450
"r7",
451
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
452
let host = &mut host_getter(caller.data_mut());
453
let r = Host::r7(host);
454
Ok((r,))
455
},
456
)?;
457
inst.func_wrap(
458
"r8",
459
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
460
let host = &mut host_getter(caller.data_mut());
461
let r = Host::r8(host);
462
Ok((r,))
463
},
464
)?;
465
inst.func_wrap(
466
"pair-ret",
467
move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {
468
let host = &mut host_getter(caller.data_mut());
469
let r = Host::pair_ret(host);
470
Ok((r,))
471
},
472
)?;
473
Ok(())
474
}
475
}
476
}
477
}
478
pub mod exports {
479
pub mod foo {
480
pub mod foo {
481
#[allow(clippy::all)]
482
pub mod integers {
483
#[allow(unused_imports)]
484
use wasmtime::component::__internal::{anyhow, Box};
485
pub struct Guest {
486
a1: wasmtime::component::Func,
487
a2: wasmtime::component::Func,
488
a3: wasmtime::component::Func,
489
a4: wasmtime::component::Func,
490
a5: wasmtime::component::Func,
491
a6: wasmtime::component::Func,
492
a7: wasmtime::component::Func,
493
a8: wasmtime::component::Func,
494
a9: wasmtime::component::Func,
495
r1: wasmtime::component::Func,
496
r2: wasmtime::component::Func,
497
r3: wasmtime::component::Func,
498
r4: wasmtime::component::Func,
499
r5: wasmtime::component::Func,
500
r6: wasmtime::component::Func,
501
r7: wasmtime::component::Func,
502
r8: wasmtime::component::Func,
503
pair_ret: wasmtime::component::Func,
504
}
505
#[derive(Clone)]
506
pub struct GuestIndices {
507
a1: wasmtime::component::ComponentExportIndex,
508
a2: wasmtime::component::ComponentExportIndex,
509
a3: wasmtime::component::ComponentExportIndex,
510
a4: wasmtime::component::ComponentExportIndex,
511
a5: wasmtime::component::ComponentExportIndex,
512
a6: wasmtime::component::ComponentExportIndex,
513
a7: wasmtime::component::ComponentExportIndex,
514
a8: wasmtime::component::ComponentExportIndex,
515
a9: wasmtime::component::ComponentExportIndex,
516
r1: wasmtime::component::ComponentExportIndex,
517
r2: wasmtime::component::ComponentExportIndex,
518
r3: wasmtime::component::ComponentExportIndex,
519
r4: wasmtime::component::ComponentExportIndex,
520
r5: wasmtime::component::ComponentExportIndex,
521
r6: wasmtime::component::ComponentExportIndex,
522
r7: wasmtime::component::ComponentExportIndex,
523
r8: wasmtime::component::ComponentExportIndex,
524
pair_ret: wasmtime::component::ComponentExportIndex,
525
}
526
impl GuestIndices {
527
/// Constructor for [`GuestIndices`] which takes a
528
/// [`Component`](wasmtime::component::Component) as input and can be executed
529
/// before instantiation.
530
///
531
/// This constructor can be used to front-load string lookups to find exports
532
/// within a component.
533
pub fn new<_T>(
534
_instance_pre: &wasmtime::component::InstancePre<_T>,
535
) -> wasmtime::Result<GuestIndices> {
536
let instance = _instance_pre
537
.component()
538
.get_export_index(None, "foo:foo/integers")
539
.ok_or_else(|| {
540
anyhow::anyhow!(
541
"no exported instance named `foo:foo/integers`"
542
)
543
})?;
544
let mut lookup = move |name| {
545
_instance_pre
546
.component()
547
.get_export_index(Some(&instance), name)
548
.ok_or_else(|| {
549
anyhow::anyhow!(
550
"instance export `foo:foo/integers` does \
551
not have export `{name}`"
552
)
553
})
554
};
555
let _ = &mut lookup;
556
let a1 = lookup("a1")?;
557
let a2 = lookup("a2")?;
558
let a3 = lookup("a3")?;
559
let a4 = lookup("a4")?;
560
let a5 = lookup("a5")?;
561
let a6 = lookup("a6")?;
562
let a7 = lookup("a7")?;
563
let a8 = lookup("a8")?;
564
let a9 = lookup("a9")?;
565
let r1 = lookup("r1")?;
566
let r2 = lookup("r2")?;
567
let r3 = lookup("r3")?;
568
let r4 = lookup("r4")?;
569
let r5 = lookup("r5")?;
570
let r6 = lookup("r6")?;
571
let r7 = lookup("r7")?;
572
let r8 = lookup("r8")?;
573
let pair_ret = lookup("pair-ret")?;
574
Ok(GuestIndices {
575
a1,
576
a2,
577
a3,
578
a4,
579
a5,
580
a6,
581
a7,
582
a8,
583
a9,
584
r1,
585
r2,
586
r3,
587
r4,
588
r5,
589
r6,
590
r7,
591
r8,
592
pair_ret,
593
})
594
}
595
pub fn load(
596
&self,
597
mut store: impl wasmtime::AsContextMut,
598
instance: &wasmtime::component::Instance,
599
) -> wasmtime::Result<Guest> {
600
let _instance = instance;
601
let _instance_pre = _instance.instance_pre(&store);
602
let _instance_type = _instance_pre.instance_type();
603
let mut store = store.as_context_mut();
604
let _ = &mut store;
605
let a1 = *_instance
606
.get_typed_func::<(u8,), ()>(&mut store, &self.a1)?
607
.func();
608
let a2 = *_instance
609
.get_typed_func::<(i8,), ()>(&mut store, &self.a2)?
610
.func();
611
let a3 = *_instance
612
.get_typed_func::<(u16,), ()>(&mut store, &self.a3)?
613
.func();
614
let a4 = *_instance
615
.get_typed_func::<(i16,), ()>(&mut store, &self.a4)?
616
.func();
617
let a5 = *_instance
618
.get_typed_func::<(u32,), ()>(&mut store, &self.a5)?
619
.func();
620
let a6 = *_instance
621
.get_typed_func::<(i32,), ()>(&mut store, &self.a6)?
622
.func();
623
let a7 = *_instance
624
.get_typed_func::<(u64,), ()>(&mut store, &self.a7)?
625
.func();
626
let a8 = *_instance
627
.get_typed_func::<(i64,), ()>(&mut store, &self.a8)?
628
.func();
629
let a9 = *_instance
630
.get_typed_func::<
631
(u8, i8, u16, i16, u32, i32, u64, i64),
632
(),
633
>(&mut store, &self.a9)?
634
.func();
635
let r1 = *_instance
636
.get_typed_func::<(), (u8,)>(&mut store, &self.r1)?
637
.func();
638
let r2 = *_instance
639
.get_typed_func::<(), (i8,)>(&mut store, &self.r2)?
640
.func();
641
let r3 = *_instance
642
.get_typed_func::<(), (u16,)>(&mut store, &self.r3)?
643
.func();
644
let r4 = *_instance
645
.get_typed_func::<(), (i16,)>(&mut store, &self.r4)?
646
.func();
647
let r5 = *_instance
648
.get_typed_func::<(), (u32,)>(&mut store, &self.r5)?
649
.func();
650
let r6 = *_instance
651
.get_typed_func::<(), (i32,)>(&mut store, &self.r6)?
652
.func();
653
let r7 = *_instance
654
.get_typed_func::<(), (u64,)>(&mut store, &self.r7)?
655
.func();
656
let r8 = *_instance
657
.get_typed_func::<(), (i64,)>(&mut store, &self.r8)?
658
.func();
659
let pair_ret = *_instance
660
.get_typed_func::<
661
(),
662
((i64, u8),),
663
>(&mut store, &self.pair_ret)?
664
.func();
665
Ok(Guest {
666
a1,
667
a2,
668
a3,
669
a4,
670
a5,
671
a6,
672
a7,
673
a8,
674
a9,
675
r1,
676
r2,
677
r3,
678
r4,
679
r5,
680
r6,
681
r7,
682
r8,
683
pair_ret,
684
})
685
}
686
}
687
impl Guest {
688
pub fn call_a1<S: wasmtime::AsContextMut>(
689
&self,
690
mut store: S,
691
arg0: u8,
692
) -> wasmtime::Result<()> {
693
let callee = unsafe {
694
wasmtime::component::TypedFunc::<
695
(u8,),
696
(),
697
>::new_unchecked(self.a1)
698
};
699
let () = callee.call(store.as_context_mut(), (arg0,))?;
700
callee.post_return(store.as_context_mut())?;
701
Ok(())
702
}
703
pub fn call_a2<S: wasmtime::AsContextMut>(
704
&self,
705
mut store: S,
706
arg0: i8,
707
) -> wasmtime::Result<()> {
708
let callee = unsafe {
709
wasmtime::component::TypedFunc::<
710
(i8,),
711
(),
712
>::new_unchecked(self.a2)
713
};
714
let () = callee.call(store.as_context_mut(), (arg0,))?;
715
callee.post_return(store.as_context_mut())?;
716
Ok(())
717
}
718
pub fn call_a3<S: wasmtime::AsContextMut>(
719
&self,
720
mut store: S,
721
arg0: u16,
722
) -> wasmtime::Result<()> {
723
let callee = unsafe {
724
wasmtime::component::TypedFunc::<
725
(u16,),
726
(),
727
>::new_unchecked(self.a3)
728
};
729
let () = callee.call(store.as_context_mut(), (arg0,))?;
730
callee.post_return(store.as_context_mut())?;
731
Ok(())
732
}
733
pub fn call_a4<S: wasmtime::AsContextMut>(
734
&self,
735
mut store: S,
736
arg0: i16,
737
) -> wasmtime::Result<()> {
738
let callee = unsafe {
739
wasmtime::component::TypedFunc::<
740
(i16,),
741
(),
742
>::new_unchecked(self.a4)
743
};
744
let () = callee.call(store.as_context_mut(), (arg0,))?;
745
callee.post_return(store.as_context_mut())?;
746
Ok(())
747
}
748
pub fn call_a5<S: wasmtime::AsContextMut>(
749
&self,
750
mut store: S,
751
arg0: u32,
752
) -> wasmtime::Result<()> {
753
let callee = unsafe {
754
wasmtime::component::TypedFunc::<
755
(u32,),
756
(),
757
>::new_unchecked(self.a5)
758
};
759
let () = callee.call(store.as_context_mut(), (arg0,))?;
760
callee.post_return(store.as_context_mut())?;
761
Ok(())
762
}
763
pub fn call_a6<S: wasmtime::AsContextMut>(
764
&self,
765
mut store: S,
766
arg0: i32,
767
) -> wasmtime::Result<()> {
768
let callee = unsafe {
769
wasmtime::component::TypedFunc::<
770
(i32,),
771
(),
772
>::new_unchecked(self.a6)
773
};
774
let () = callee.call(store.as_context_mut(), (arg0,))?;
775
callee.post_return(store.as_context_mut())?;
776
Ok(())
777
}
778
pub fn call_a7<S: wasmtime::AsContextMut>(
779
&self,
780
mut store: S,
781
arg0: u64,
782
) -> wasmtime::Result<()> {
783
let callee = unsafe {
784
wasmtime::component::TypedFunc::<
785
(u64,),
786
(),
787
>::new_unchecked(self.a7)
788
};
789
let () = callee.call(store.as_context_mut(), (arg0,))?;
790
callee.post_return(store.as_context_mut())?;
791
Ok(())
792
}
793
pub fn call_a8<S: wasmtime::AsContextMut>(
794
&self,
795
mut store: S,
796
arg0: i64,
797
) -> wasmtime::Result<()> {
798
let callee = unsafe {
799
wasmtime::component::TypedFunc::<
800
(i64,),
801
(),
802
>::new_unchecked(self.a8)
803
};
804
let () = callee.call(store.as_context_mut(), (arg0,))?;
805
callee.post_return(store.as_context_mut())?;
806
Ok(())
807
}
808
pub fn call_a9<S: wasmtime::AsContextMut>(
809
&self,
810
mut store: S,
811
arg0: u8,
812
arg1: i8,
813
arg2: u16,
814
arg3: i16,
815
arg4: u32,
816
arg5: i32,
817
arg6: u64,
818
arg7: i64,
819
) -> wasmtime::Result<()> {
820
let callee = unsafe {
821
wasmtime::component::TypedFunc::<
822
(u8, i8, u16, i16, u32, i32, u64, i64),
823
(),
824
>::new_unchecked(self.a9)
825
};
826
let () = callee
827
.call(
828
store.as_context_mut(),
829
(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7),
830
)?;
831
callee.post_return(store.as_context_mut())?;
832
Ok(())
833
}
834
pub fn call_r1<S: wasmtime::AsContextMut>(
835
&self,
836
mut store: S,
837
) -> wasmtime::Result<u8> {
838
let callee = unsafe {
839
wasmtime::component::TypedFunc::<
840
(),
841
(u8,),
842
>::new_unchecked(self.r1)
843
};
844
let (ret0,) = callee.call(store.as_context_mut(), ())?;
845
callee.post_return(store.as_context_mut())?;
846
Ok(ret0)
847
}
848
pub fn call_r2<S: wasmtime::AsContextMut>(
849
&self,
850
mut store: S,
851
) -> wasmtime::Result<i8> {
852
let callee = unsafe {
853
wasmtime::component::TypedFunc::<
854
(),
855
(i8,),
856
>::new_unchecked(self.r2)
857
};
858
let (ret0,) = callee.call(store.as_context_mut(), ())?;
859
callee.post_return(store.as_context_mut())?;
860
Ok(ret0)
861
}
862
pub fn call_r3<S: wasmtime::AsContextMut>(
863
&self,
864
mut store: S,
865
) -> wasmtime::Result<u16> {
866
let callee = unsafe {
867
wasmtime::component::TypedFunc::<
868
(),
869
(u16,),
870
>::new_unchecked(self.r3)
871
};
872
let (ret0,) = callee.call(store.as_context_mut(), ())?;
873
callee.post_return(store.as_context_mut())?;
874
Ok(ret0)
875
}
876
pub fn call_r4<S: wasmtime::AsContextMut>(
877
&self,
878
mut store: S,
879
) -> wasmtime::Result<i16> {
880
let callee = unsafe {
881
wasmtime::component::TypedFunc::<
882
(),
883
(i16,),
884
>::new_unchecked(self.r4)
885
};
886
let (ret0,) = callee.call(store.as_context_mut(), ())?;
887
callee.post_return(store.as_context_mut())?;
888
Ok(ret0)
889
}
890
pub fn call_r5<S: wasmtime::AsContextMut>(
891
&self,
892
mut store: S,
893
) -> wasmtime::Result<u32> {
894
let callee = unsafe {
895
wasmtime::component::TypedFunc::<
896
(),
897
(u32,),
898
>::new_unchecked(self.r5)
899
};
900
let (ret0,) = callee.call(store.as_context_mut(), ())?;
901
callee.post_return(store.as_context_mut())?;
902
Ok(ret0)
903
}
904
pub fn call_r6<S: wasmtime::AsContextMut>(
905
&self,
906
mut store: S,
907
) -> wasmtime::Result<i32> {
908
let callee = unsafe {
909
wasmtime::component::TypedFunc::<
910
(),
911
(i32,),
912
>::new_unchecked(self.r6)
913
};
914
let (ret0,) = callee.call(store.as_context_mut(), ())?;
915
callee.post_return(store.as_context_mut())?;
916
Ok(ret0)
917
}
918
pub fn call_r7<S: wasmtime::AsContextMut>(
919
&self,
920
mut store: S,
921
) -> wasmtime::Result<u64> {
922
let callee = unsafe {
923
wasmtime::component::TypedFunc::<
924
(),
925
(u64,),
926
>::new_unchecked(self.r7)
927
};
928
let (ret0,) = callee.call(store.as_context_mut(), ())?;
929
callee.post_return(store.as_context_mut())?;
930
Ok(ret0)
931
}
932
pub fn call_r8<S: wasmtime::AsContextMut>(
933
&self,
934
mut store: S,
935
) -> wasmtime::Result<i64> {
936
let callee = unsafe {
937
wasmtime::component::TypedFunc::<
938
(),
939
(i64,),
940
>::new_unchecked(self.r8)
941
};
942
let (ret0,) = callee.call(store.as_context_mut(), ())?;
943
callee.post_return(store.as_context_mut())?;
944
Ok(ret0)
945
}
946
pub fn call_pair_ret<S: wasmtime::AsContextMut>(
947
&self,
948
mut store: S,
949
) -> wasmtime::Result<(i64, u8)> {
950
let callee = unsafe {
951
wasmtime::component::TypedFunc::<
952
(),
953
((i64, u8),),
954
>::new_unchecked(self.pair_ret)
955
};
956
let (ret0,) = callee.call(store.as_context_mut(), ())?;
957
callee.post_return(store.as_context_mut())?;
958
Ok(ret0)
959
}
960
}
961
}
962
}
963
}
964
}
965
966