Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/component-macro/tests/expanded/many-arguments_tracing_async.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::manyarg::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::manyarg::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::manyarg::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::manyarg::HostWithStore + Send,
179
for<'a> D::Data<'a>: foo::foo::manyarg::Host + Send,
180
T: 'static + Send,
181
{
182
foo::foo::manyarg::add_to_linker::<T, D>(linker, host_getter)?;
183
Ok(())
184
}
185
pub fn foo_foo_manyarg(&self) -> &exports::foo::foo::manyarg::Guest {
186
&self.interface0
187
}
188
}
189
};
190
pub mod foo {
191
pub mod foo {
192
#[allow(clippy::all)]
193
pub mod manyarg {
194
#[allow(unused_imports)]
195
use wasmtime::component::__internal::{anyhow, Box};
196
#[derive(wasmtime::component::ComponentType)]
197
#[derive(wasmtime::component::Lift)]
198
#[derive(wasmtime::component::Lower)]
199
#[component(record)]
200
#[derive(Clone)]
201
pub struct BigStruct {
202
#[component(name = "a1")]
203
pub a1: wasmtime::component::__internal::String,
204
#[component(name = "a2")]
205
pub a2: wasmtime::component::__internal::String,
206
#[component(name = "a3")]
207
pub a3: wasmtime::component::__internal::String,
208
#[component(name = "a4")]
209
pub a4: wasmtime::component::__internal::String,
210
#[component(name = "a5")]
211
pub a5: wasmtime::component::__internal::String,
212
#[component(name = "a6")]
213
pub a6: wasmtime::component::__internal::String,
214
#[component(name = "a7")]
215
pub a7: wasmtime::component::__internal::String,
216
#[component(name = "a8")]
217
pub a8: wasmtime::component::__internal::String,
218
#[component(name = "a9")]
219
pub a9: wasmtime::component::__internal::String,
220
#[component(name = "a10")]
221
pub a10: wasmtime::component::__internal::String,
222
#[component(name = "a11")]
223
pub a11: wasmtime::component::__internal::String,
224
#[component(name = "a12")]
225
pub a12: wasmtime::component::__internal::String,
226
#[component(name = "a13")]
227
pub a13: wasmtime::component::__internal::String,
228
#[component(name = "a14")]
229
pub a14: wasmtime::component::__internal::String,
230
#[component(name = "a15")]
231
pub a15: wasmtime::component::__internal::String,
232
#[component(name = "a16")]
233
pub a16: wasmtime::component::__internal::String,
234
#[component(name = "a17")]
235
pub a17: wasmtime::component::__internal::String,
236
#[component(name = "a18")]
237
pub a18: wasmtime::component::__internal::String,
238
#[component(name = "a19")]
239
pub a19: wasmtime::component::__internal::String,
240
#[component(name = "a20")]
241
pub a20: wasmtime::component::__internal::String,
242
}
243
impl core::fmt::Debug for BigStruct {
244
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
245
f.debug_struct("BigStruct")
246
.field("a1", &self.a1)
247
.field("a2", &self.a2)
248
.field("a3", &self.a3)
249
.field("a4", &self.a4)
250
.field("a5", &self.a5)
251
.field("a6", &self.a6)
252
.field("a7", &self.a7)
253
.field("a8", &self.a8)
254
.field("a9", &self.a9)
255
.field("a10", &self.a10)
256
.field("a11", &self.a11)
257
.field("a12", &self.a12)
258
.field("a13", &self.a13)
259
.field("a14", &self.a14)
260
.field("a15", &self.a15)
261
.field("a16", &self.a16)
262
.field("a17", &self.a17)
263
.field("a18", &self.a18)
264
.field("a19", &self.a19)
265
.field("a20", &self.a20)
266
.finish()
267
}
268
}
269
const _: () = {
270
assert!(
271
160 == < BigStruct as wasmtime::component::ComponentType >::SIZE32
272
);
273
assert!(
274
4 == < BigStruct as wasmtime::component::ComponentType >::ALIGN32
275
);
276
};
277
pub trait HostWithStore: wasmtime::component::HasData + Send {}
278
impl<_T: ?Sized> HostWithStore for _T
279
where
280
_T: wasmtime::component::HasData + Send,
281
{}
282
pub trait Host: Send {
283
fn many_args(
284
&mut self,
285
a1: u64,
286
a2: u64,
287
a3: u64,
288
a4: u64,
289
a5: u64,
290
a6: u64,
291
a7: u64,
292
a8: u64,
293
a9: u64,
294
a10: u64,
295
a11: u64,
296
a12: u64,
297
a13: u64,
298
a14: u64,
299
a15: u64,
300
a16: u64,
301
) -> impl ::core::future::Future<Output = ()> + Send;
302
fn big_argument(
303
&mut self,
304
x: BigStruct,
305
) -> impl ::core::future::Future<Output = ()> + Send;
306
}
307
impl<_T: Host + ?Sized + Send> Host for &mut _T {
308
fn many_args(
309
&mut self,
310
a1: u64,
311
a2: u64,
312
a3: u64,
313
a4: u64,
314
a5: u64,
315
a6: u64,
316
a7: u64,
317
a8: u64,
318
a9: u64,
319
a10: u64,
320
a11: u64,
321
a12: u64,
322
a13: u64,
323
a14: u64,
324
a15: u64,
325
a16: u64,
326
) -> impl ::core::future::Future<Output = ()> + Send {
327
async move {
328
Host::many_args(
329
*self,
330
a1,
331
a2,
332
a3,
333
a4,
334
a5,
335
a6,
336
a7,
337
a8,
338
a9,
339
a10,
340
a11,
341
a12,
342
a13,
343
a14,
344
a15,
345
a16,
346
)
347
.await
348
}
349
}
350
fn big_argument(
351
&mut self,
352
x: BigStruct,
353
) -> impl ::core::future::Future<Output = ()> + Send {
354
async move { Host::big_argument(*self, x).await }
355
}
356
}
357
pub fn add_to_linker<T, D>(
358
linker: &mut wasmtime::component::Linker<T>,
359
host_getter: fn(&mut T) -> D::Data<'_>,
360
) -> wasmtime::Result<()>
361
where
362
D: HostWithStore,
363
for<'a> D::Data<'a>: Host,
364
T: 'static + Send,
365
{
366
let mut inst = linker.instance("foo:foo/manyarg")?;
367
inst.func_wrap_async(
368
"many-args",
369
move |
370
mut caller: wasmtime::StoreContextMut<'_, T>,
371
(
372
arg0,
373
arg1,
374
arg2,
375
arg3,
376
arg4,
377
arg5,
378
arg6,
379
arg7,
380
arg8,
381
arg9,
382
arg10,
383
arg11,
384
arg12,
385
arg13,
386
arg14,
387
arg15,
388
): (
389
u64,
390
u64,
391
u64,
392
u64,
393
u64,
394
u64,
395
u64,
396
u64,
397
u64,
398
u64,
399
u64,
400
u64,
401
u64,
402
u64,
403
u64,
404
u64,
405
)|
406
{
407
use tracing::Instrument;
408
let span = tracing::span!(
409
tracing::Level::TRACE, "wit-bindgen import", module =
410
"manyarg", function = "many-args",
411
);
412
wasmtime::component::__internal::Box::new(
413
async move {
414
tracing::event!(
415
tracing::Level::TRACE, a1 = tracing::field::debug(& arg0),
416
a2 = tracing::field::debug(& arg1), a3 =
417
tracing::field::debug(& arg2), a4 = tracing::field::debug(&
418
arg3), a5 = tracing::field::debug(& arg4), a6 =
419
tracing::field::debug(& arg5), a7 = tracing::field::debug(&
420
arg6), a8 = tracing::field::debug(& arg7), a9 =
421
tracing::field::debug(& arg8), a10 = tracing::field::debug(&
422
arg9), a11 = tracing::field::debug(& arg10), a12 =
423
tracing::field::debug(& arg11), a13 =
424
tracing::field::debug(& arg12), a14 =
425
tracing::field::debug(& arg13), a15 =
426
tracing::field::debug(& arg14), a16 =
427
tracing::field::debug(& arg15), "call"
428
);
429
let host = &mut host_getter(caller.data_mut());
430
let r = Host::many_args(
431
host,
432
arg0,
433
arg1,
434
arg2,
435
arg3,
436
arg4,
437
arg5,
438
arg6,
439
arg7,
440
arg8,
441
arg9,
442
arg10,
443
arg11,
444
arg12,
445
arg13,
446
arg14,
447
arg15,
448
)
449
.await;
450
tracing::event!(
451
tracing::Level::TRACE, result = tracing::field::debug(& r),
452
"return"
453
);
454
Ok(r)
455
}
456
.instrument(span),
457
)
458
},
459
)?;
460
inst.func_wrap_async(
461
"big-argument",
462
move |
463
mut caller: wasmtime::StoreContextMut<'_, T>,
464
(arg0,): (BigStruct,)|
465
{
466
use tracing::Instrument;
467
let span = tracing::span!(
468
tracing::Level::TRACE, "wit-bindgen import", module =
469
"manyarg", function = "big-argument",
470
);
471
wasmtime::component::__internal::Box::new(
472
async move {
473
tracing::event!(
474
tracing::Level::TRACE, x = tracing::field::debug(& arg0),
475
"call"
476
);
477
let host = &mut host_getter(caller.data_mut());
478
let r = Host::big_argument(host, arg0).await;
479
tracing::event!(
480
tracing::Level::TRACE, result = tracing::field::debug(& r),
481
"return"
482
);
483
Ok(r)
484
}
485
.instrument(span),
486
)
487
},
488
)?;
489
Ok(())
490
}
491
}
492
}
493
}
494
pub mod exports {
495
pub mod foo {
496
pub mod foo {
497
#[allow(clippy::all)]
498
pub mod manyarg {
499
#[allow(unused_imports)]
500
use wasmtime::component::__internal::{anyhow, Box};
501
#[derive(wasmtime::component::ComponentType)]
502
#[derive(wasmtime::component::Lift)]
503
#[derive(wasmtime::component::Lower)]
504
#[component(record)]
505
#[derive(Clone)]
506
pub struct BigStruct {
507
#[component(name = "a1")]
508
pub a1: wasmtime::component::__internal::String,
509
#[component(name = "a2")]
510
pub a2: wasmtime::component::__internal::String,
511
#[component(name = "a3")]
512
pub a3: wasmtime::component::__internal::String,
513
#[component(name = "a4")]
514
pub a4: wasmtime::component::__internal::String,
515
#[component(name = "a5")]
516
pub a5: wasmtime::component::__internal::String,
517
#[component(name = "a6")]
518
pub a6: wasmtime::component::__internal::String,
519
#[component(name = "a7")]
520
pub a7: wasmtime::component::__internal::String,
521
#[component(name = "a8")]
522
pub a8: wasmtime::component::__internal::String,
523
#[component(name = "a9")]
524
pub a9: wasmtime::component::__internal::String,
525
#[component(name = "a10")]
526
pub a10: wasmtime::component::__internal::String,
527
#[component(name = "a11")]
528
pub a11: wasmtime::component::__internal::String,
529
#[component(name = "a12")]
530
pub a12: wasmtime::component::__internal::String,
531
#[component(name = "a13")]
532
pub a13: wasmtime::component::__internal::String,
533
#[component(name = "a14")]
534
pub a14: wasmtime::component::__internal::String,
535
#[component(name = "a15")]
536
pub a15: wasmtime::component::__internal::String,
537
#[component(name = "a16")]
538
pub a16: wasmtime::component::__internal::String,
539
#[component(name = "a17")]
540
pub a17: wasmtime::component::__internal::String,
541
#[component(name = "a18")]
542
pub a18: wasmtime::component::__internal::String,
543
#[component(name = "a19")]
544
pub a19: wasmtime::component::__internal::String,
545
#[component(name = "a20")]
546
pub a20: wasmtime::component::__internal::String,
547
}
548
impl core::fmt::Debug for BigStruct {
549
fn fmt(
550
&self,
551
f: &mut core::fmt::Formatter<'_>,
552
) -> core::fmt::Result {
553
f.debug_struct("BigStruct")
554
.field("a1", &self.a1)
555
.field("a2", &self.a2)
556
.field("a3", &self.a3)
557
.field("a4", &self.a4)
558
.field("a5", &self.a5)
559
.field("a6", &self.a6)
560
.field("a7", &self.a7)
561
.field("a8", &self.a8)
562
.field("a9", &self.a9)
563
.field("a10", &self.a10)
564
.field("a11", &self.a11)
565
.field("a12", &self.a12)
566
.field("a13", &self.a13)
567
.field("a14", &self.a14)
568
.field("a15", &self.a15)
569
.field("a16", &self.a16)
570
.field("a17", &self.a17)
571
.field("a18", &self.a18)
572
.field("a19", &self.a19)
573
.field("a20", &self.a20)
574
.finish()
575
}
576
}
577
const _: () = {
578
assert!(
579
160 == < BigStruct as wasmtime::component::ComponentType
580
>::SIZE32
581
);
582
assert!(
583
4 == < BigStruct as wasmtime::component::ComponentType >::ALIGN32
584
);
585
};
586
pub struct Guest {
587
many_args: wasmtime::component::Func,
588
big_argument: wasmtime::component::Func,
589
}
590
#[derive(Clone)]
591
pub struct GuestIndices {
592
many_args: wasmtime::component::ComponentExportIndex,
593
big_argument: wasmtime::component::ComponentExportIndex,
594
}
595
impl GuestIndices {
596
/// Constructor for [`GuestIndices`] which takes a
597
/// [`Component`](wasmtime::component::Component) as input and can be executed
598
/// before instantiation.
599
///
600
/// This constructor can be used to front-load string lookups to find exports
601
/// within a component.
602
pub fn new<_T>(
603
_instance_pre: &wasmtime::component::InstancePre<_T>,
604
) -> wasmtime::Result<GuestIndices> {
605
let instance = _instance_pre
606
.component()
607
.get_export_index(None, "foo:foo/manyarg")
608
.ok_or_else(|| {
609
anyhow::anyhow!(
610
"no exported instance named `foo:foo/manyarg`"
611
)
612
})?;
613
let mut lookup = move |name| {
614
_instance_pre
615
.component()
616
.get_export_index(Some(&instance), name)
617
.ok_or_else(|| {
618
anyhow::anyhow!(
619
"instance export `foo:foo/manyarg` does \
620
not have export `{name}`"
621
)
622
})
623
};
624
let _ = &mut lookup;
625
let many_args = lookup("many-args")?;
626
let big_argument = lookup("big-argument")?;
627
Ok(GuestIndices {
628
many_args,
629
big_argument,
630
})
631
}
632
pub fn load(
633
&self,
634
mut store: impl wasmtime::AsContextMut,
635
instance: &wasmtime::component::Instance,
636
) -> wasmtime::Result<Guest> {
637
let _instance = instance;
638
let _instance_pre = _instance.instance_pre(&store);
639
let _instance_type = _instance_pre.instance_type();
640
let mut store = store.as_context_mut();
641
let _ = &mut store;
642
let many_args = *_instance
643
.get_typed_func::<
644
(
645
u64,
646
u64,
647
u64,
648
u64,
649
u64,
650
u64,
651
u64,
652
u64,
653
u64,
654
u64,
655
u64,
656
u64,
657
u64,
658
u64,
659
u64,
660
u64,
661
),
662
(),
663
>(&mut store, &self.many_args)?
664
.func();
665
let big_argument = *_instance
666
.get_typed_func::<
667
(&BigStruct,),
668
(),
669
>(&mut store, &self.big_argument)?
670
.func();
671
Ok(Guest { many_args, big_argument })
672
}
673
}
674
impl Guest {
675
pub async fn call_many_args<S: wasmtime::AsContextMut>(
676
&self,
677
mut store: S,
678
arg0: u64,
679
arg1: u64,
680
arg2: u64,
681
arg3: u64,
682
arg4: u64,
683
arg5: u64,
684
arg6: u64,
685
arg7: u64,
686
arg8: u64,
687
arg9: u64,
688
arg10: u64,
689
arg11: u64,
690
arg12: u64,
691
arg13: u64,
692
arg14: u64,
693
arg15: u64,
694
) -> wasmtime::Result<()>
695
where
696
<S as wasmtime::AsContext>::Data: Send,
697
{
698
use tracing::Instrument;
699
let span = tracing::span!(
700
tracing::Level::TRACE, "wit-bindgen export", module =
701
"foo:foo/manyarg", function = "many-args",
702
);
703
let callee = unsafe {
704
wasmtime::component::TypedFunc::<
705
(
706
u64,
707
u64,
708
u64,
709
u64,
710
u64,
711
u64,
712
u64,
713
u64,
714
u64,
715
u64,
716
u64,
717
u64,
718
u64,
719
u64,
720
u64,
721
u64,
722
),
723
(),
724
>::new_unchecked(self.many_args)
725
};
726
let () = callee
727
.call_async(
728
store.as_context_mut(),
729
(
730
arg0,
731
arg1,
732
arg2,
733
arg3,
734
arg4,
735
arg5,
736
arg6,
737
arg7,
738
arg8,
739
arg9,
740
arg10,
741
arg11,
742
arg12,
743
arg13,
744
arg14,
745
arg15,
746
),
747
)
748
.instrument(span.clone())
749
.await?;
750
callee
751
.post_return_async(store.as_context_mut())
752
.instrument(span)
753
.await?;
754
Ok(())
755
}
756
pub async fn call_big_argument<S: wasmtime::AsContextMut>(
757
&self,
758
mut store: S,
759
arg0: &BigStruct,
760
) -> wasmtime::Result<()>
761
where
762
<S as wasmtime::AsContext>::Data: Send,
763
{
764
use tracing::Instrument;
765
let span = tracing::span!(
766
tracing::Level::TRACE, "wit-bindgen export", module =
767
"foo:foo/manyarg", function = "big-argument",
768
);
769
let callee = unsafe {
770
wasmtime::component::TypedFunc::<
771
(&BigStruct,),
772
(),
773
>::new_unchecked(self.big_argument)
774
};
775
let () = callee
776
.call_async(store.as_context_mut(), (arg0,))
777
.instrument(span.clone())
778
.await?;
779
callee
780
.post_return_async(store.as_context_mut())
781
.instrument(span)
782
.await?;
783
Ok(())
784
}
785
}
786
}
787
}
788
}
789
}
790
791