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