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 async fn instantiate_async( 47 &self, 48 mut store: impl wasmtime::AsContextMut<Data = _T>, 49 ) -> wasmtime::Result<TheWorld> 50 where 51 _T: Send + 'static, 52 { 53 let mut store = store.as_context_mut(); 54 let instance = self.instance_pre.instantiate_async(&mut store).await?; 55 self.indices.load(&mut store, &instance) 56 } 57 } 58 /// Auto-generated bindings for index of the exports of 59 /// `the-world`. 60 /// 61 /// This is an implementation detail of [`TheWorldPre`] and can 62 /// be constructed if needed as well. 63 /// 64 /// For more information see [`TheWorld`] as well. 65 #[derive(Clone)] 66 pub struct TheWorldIndices { 67 interface0: exports::foo::foo::simple::GuestIndices, 68 } 69 /// Auto-generated bindings for an instance a component which 70 /// implements the world `the-world`. 71 /// 72 /// This structure can be created through a number of means 73 /// depending on your requirements and what you have on hand: 74 /// 75 /// * The most convenient way is to use 76 /// [`TheWorld::instantiate_async`] which only needs a 77 /// [`Store`], [`Component`], and [`Linker`]. 78 /// 79 /// * Alternatively you can create a [`TheWorldPre`] ahead of 80 /// time with a [`Component`] to front-load string lookups 81 /// of exports once instead of per-instantiation. This 82 /// method then uses [`TheWorldPre::instantiate_async`] to 83 /// create a [`TheWorld`]. 84 /// 85 /// * If you've instantiated the instance yourself already 86 /// then you can use [`TheWorld::new`]. 87 /// 88 /// These methods are all equivalent to one another and move 89 /// around the tradeoff of what work is performed when. 90 /// 91 /// [`Store`]: wasmtime::Store 92 /// [`Component`]: wasmtime::component::Component 93 /// [`Linker`]: wasmtime::component::Linker 94 pub struct TheWorld { 95 interface0: exports::foo::foo::simple::Guest, 96 } 97 const _: () = { 98 #[allow(unused_imports)] 99 use wasmtime::component::__internal::anyhow; 100 impl TheWorldIndices { 101 /// Creates a new copy of `TheWorldIndices` bindings which can then 102 /// be used to instantiate into a particular store. 103 /// 104 /// This method may fail if the component does not have the 105 /// required exports. 106 pub fn new<_T>( 107 _instance_pre: &wasmtime::component::InstancePre<_T>, 108 ) -> wasmtime::Result<Self> { 109 let _component = _instance_pre.component(); 110 let _instance_type = _instance_pre.instance_type(); 111 let interface0 = exports::foo::foo::simple::GuestIndices::new( 112 _instance_pre, 113 )?; 114 Ok(TheWorldIndices { interface0 }) 115 } 116 /// Uses the indices stored in `self` to load an instance 117 /// of [`TheWorld`] from the instance provided. 118 /// 119 /// Note that at this time this method will additionally 120 /// perform type-checks of all exports. 121 pub fn load( 122 &self, 123 mut store: impl wasmtime::AsContextMut, 124 instance: &wasmtime::component::Instance, 125 ) -> wasmtime::Result<TheWorld> { 126 let _ = &mut store; 127 let _instance = instance; 128 let interface0 = self.interface0.load(&mut store, &_instance)?; 129 Ok(TheWorld { interface0 }) 130 } 131 } 132 impl TheWorld { 133 /// Convenience wrapper around [`TheWorldPre::new`] and 134 /// [`TheWorldPre::instantiate_async`]. 135 pub async fn instantiate_async<_T>( 136 store: impl wasmtime::AsContextMut<Data = _T>, 137 component: &wasmtime::component::Component, 138 linker: &wasmtime::component::Linker<_T>, 139 ) -> wasmtime::Result<TheWorld> 140 where 141 _T: Send + 'static, 142 { 143 let pre = linker.instantiate_pre(component)?; 144 TheWorldPre::new(pre)?.instantiate_async(store).await 145 } 146 /// Convenience wrapper around [`TheWorldIndices::new`] and 147 /// [`TheWorldIndices::load`]. 148 pub fn new( 149 mut store: impl wasmtime::AsContextMut, 150 instance: &wasmtime::component::Instance, 151 ) -> wasmtime::Result<TheWorld> { 152 let indices = TheWorldIndices::new(&instance.instance_pre(&store))?; 153 indices.load(&mut store, instance) 154 } 155 pub fn add_to_linker<T, U>( 156 linker: &mut wasmtime::component::Linker<T>, 157 get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, 158 ) -> wasmtime::Result<()> 159 where 160 T: 'static, 161 T: Send + foo::foo::simple::Host<Data = T>, 162 U: Send + foo::foo::simple::Host<Data = T>, 163 { 164 foo::foo::simple::add_to_linker(linker, get)?; 165 Ok(()) 166 } 167 pub fn foo_foo_simple(&self) -> &exports::foo::foo::simple::Guest { 168 &self.interface0 169 } 170 } 171 }; 172 pub mod foo { 173 pub mod foo { 174 #[allow(clippy::all)] 175 pub mod simple { 176 #[allow(unused_imports)] 177 use wasmtime::component::__internal::{anyhow, Box}; 178 pub trait Host { 179 type Data; 180 fn f1( 181 store: wasmtime::StoreContextMut<'_, Self::Data>, 182 ) -> impl ::core::future::Future< 183 Output = impl FnOnce( 184 wasmtime::StoreContextMut<'_, Self::Data>, 185 ) -> () + Send + Sync + 'static, 186 > + Send + Sync + 'static 187 where 188 Self: Sized; 189 fn f2( 190 store: wasmtime::StoreContextMut<'_, Self::Data>, 191 a: u32, 192 ) -> impl ::core::future::Future< 193 Output = impl FnOnce( 194 wasmtime::StoreContextMut<'_, Self::Data>, 195 ) -> () + Send + Sync + 'static, 196 > + Send + Sync + 'static 197 where 198 Self: Sized; 199 fn f3( 200 store: wasmtime::StoreContextMut<'_, Self::Data>, 201 a: u32, 202 b: u32, 203 ) -> impl ::core::future::Future< 204 Output = impl FnOnce( 205 wasmtime::StoreContextMut<'_, Self::Data>, 206 ) -> () + Send + Sync + 'static, 207 > + Send + Sync + 'static 208 where 209 Self: Sized; 210 fn f4( 211 store: wasmtime::StoreContextMut<'_, Self::Data>, 212 ) -> impl ::core::future::Future< 213 Output = impl FnOnce( 214 wasmtime::StoreContextMut<'_, Self::Data>, 215 ) -> u32 + Send + Sync + 'static, 216 > + Send + Sync + 'static 217 where 218 Self: Sized; 219 fn f5( 220 store: wasmtime::StoreContextMut<'_, Self::Data>, 221 ) -> impl ::core::future::Future< 222 Output = impl FnOnce( 223 wasmtime::StoreContextMut<'_, Self::Data>, 224 ) -> (u32, u32) + Send + Sync + 'static, 225 > + Send + Sync + 'static 226 where 227 Self: Sized; 228 fn f6( 229 store: wasmtime::StoreContextMut<'_, Self::Data>, 230 a: u32, 231 b: u32, 232 c: u32, 233 ) -> impl ::core::future::Future< 234 Output = impl FnOnce( 235 wasmtime::StoreContextMut<'_, Self::Data>, 236 ) -> (u32, u32, u32) + Send + Sync + 'static, 237 > + Send + Sync + 'static 238 where 239 Self: Sized; 240 } 241 pub fn add_to_linker_get_host<T, G>( 242 linker: &mut wasmtime::component::Linker<T>, 243 host_getter: G, 244 ) -> wasmtime::Result<()> 245 where 246 T: 'static, 247 G: for<'a> wasmtime::component::GetHost< 248 &'a mut T, 249 Host: Host<Data = T> + Send, 250 >, 251 T: Send + 'static, 252 { 253 let mut inst = linker.instance("foo:foo/simple")?; 254 inst.func_wrap_concurrent( 255 "f1", 256 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 257 let host = caller; 258 let r = <G::Host as Host>::f1(host); 259 Box::pin(async move { 260 let fun = r.await; 261 Box::new(move |mut caller: wasmtime::StoreContextMut<'_, T>| { 262 let r = fun(caller); 263 Ok(r) 264 }) 265 as Box< 266 dyn FnOnce( 267 wasmtime::StoreContextMut<'_, T>, 268 ) -> wasmtime::Result<()> + Send + Sync, 269 > 270 }) 271 as ::core::pin::Pin< 272 Box< 273 dyn ::core::future::Future< 274 Output = Box< 275 dyn FnOnce( 276 wasmtime::StoreContextMut<'_, T>, 277 ) -> wasmtime::Result<()> + Send + Sync, 278 >, 279 > + Send + Sync + 'static, 280 >, 281 > 282 }, 283 )?; 284 inst.func_wrap_concurrent( 285 "f2", 286 move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (u32,)| { 287 let host = caller; 288 let r = <G::Host as Host>::f2(host, arg0); 289 Box::pin(async move { 290 let fun = r.await; 291 Box::new(move |mut caller: wasmtime::StoreContextMut<'_, T>| { 292 let r = fun(caller); 293 Ok(r) 294 }) 295 as Box< 296 dyn FnOnce( 297 wasmtime::StoreContextMut<'_, T>, 298 ) -> wasmtime::Result<()> + Send + Sync, 299 > 300 }) 301 as ::core::pin::Pin< 302 Box< 303 dyn ::core::future::Future< 304 Output = Box< 305 dyn FnOnce( 306 wasmtime::StoreContextMut<'_, T>, 307 ) -> wasmtime::Result<()> + Send + Sync, 308 >, 309 > + Send + Sync + 'static, 310 >, 311 > 312 }, 313 )?; 314 inst.func_wrap_concurrent( 315 "f3", 316 move | 317 mut caller: wasmtime::StoreContextMut<'_, T>, 318 (arg0, arg1): (u32, u32)| 319 { 320 let host = caller; 321 let r = <G::Host as Host>::f3(host, arg0, arg1); 322 Box::pin(async move { 323 let fun = r.await; 324 Box::new(move |mut caller: wasmtime::StoreContextMut<'_, T>| { 325 let r = fun(caller); 326 Ok(r) 327 }) 328 as Box< 329 dyn FnOnce( 330 wasmtime::StoreContextMut<'_, T>, 331 ) -> wasmtime::Result<()> + Send + Sync, 332 > 333 }) 334 as ::core::pin::Pin< 335 Box< 336 dyn ::core::future::Future< 337 Output = Box< 338 dyn FnOnce( 339 wasmtime::StoreContextMut<'_, T>, 340 ) -> wasmtime::Result<()> + Send + Sync, 341 >, 342 > + Send + Sync + 'static, 343 >, 344 > 345 }, 346 )?; 347 inst.func_wrap_concurrent( 348 "f4", 349 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 350 let host = caller; 351 let r = <G::Host as Host>::f4(host); 352 Box::pin(async move { 353 let fun = r.await; 354 Box::new(move |mut caller: wasmtime::StoreContextMut<'_, T>| { 355 let r = fun(caller); 356 Ok((r,)) 357 }) 358 as Box< 359 dyn FnOnce( 360 wasmtime::StoreContextMut<'_, T>, 361 ) -> wasmtime::Result<(u32,)> + Send + Sync, 362 > 363 }) 364 as ::core::pin::Pin< 365 Box< 366 dyn ::core::future::Future< 367 Output = Box< 368 dyn FnOnce( 369 wasmtime::StoreContextMut<'_, T>, 370 ) -> wasmtime::Result<(u32,)> + Send + Sync, 371 >, 372 > + Send + Sync + 'static, 373 >, 374 > 375 }, 376 )?; 377 inst.func_wrap_concurrent( 378 "f5", 379 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 380 let host = caller; 381 let r = <G::Host as Host>::f5(host); 382 Box::pin(async move { 383 let fun = r.await; 384 Box::new(move |mut caller: wasmtime::StoreContextMut<'_, T>| { 385 let r = fun(caller); 386 Ok((r,)) 387 }) 388 as Box< 389 dyn FnOnce( 390 wasmtime::StoreContextMut<'_, T>, 391 ) -> wasmtime::Result<((u32, u32),)> + Send + Sync, 392 > 393 }) 394 as ::core::pin::Pin< 395 Box< 396 dyn ::core::future::Future< 397 Output = Box< 398 dyn FnOnce( 399 wasmtime::StoreContextMut<'_, T>, 400 ) -> wasmtime::Result<((u32, u32),)> + Send + Sync, 401 >, 402 > + Send + Sync + 'static, 403 >, 404 > 405 }, 406 )?; 407 inst.func_wrap_concurrent( 408 "f6", 409 move | 410 mut caller: wasmtime::StoreContextMut<'_, T>, 411 (arg0, arg1, arg2): (u32, u32, u32)| 412 { 413 let host = caller; 414 let r = <G::Host as Host>::f6(host, arg0, arg1, arg2); 415 Box::pin(async move { 416 let fun = r.await; 417 Box::new(move |mut caller: wasmtime::StoreContextMut<'_, T>| { 418 let r = fun(caller); 419 Ok((r,)) 420 }) 421 as Box< 422 dyn FnOnce( 423 wasmtime::StoreContextMut<'_, T>, 424 ) -> wasmtime::Result<((u32, u32, u32),)> + Send + Sync, 425 > 426 }) 427 as ::core::pin::Pin< 428 Box< 429 dyn ::core::future::Future< 430 Output = Box< 431 dyn FnOnce( 432 wasmtime::StoreContextMut<'_, T>, 433 ) -> wasmtime::Result<((u32, u32, u32),)> + Send + Sync, 434 >, 435 > + Send + Sync + 'static, 436 >, 437 > 438 }, 439 )?; 440 Ok(()) 441 } 442 pub fn add_to_linker<T, U>( 443 linker: &mut wasmtime::component::Linker<T>, 444 get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, 445 ) -> wasmtime::Result<()> 446 where 447 T: 'static, 448 U: Host<Data = T> + Send, 449 T: Send + 'static, 450 { 451 add_to_linker_get_host(linker, get) 452 } 453 impl<_T: Host> Host for &mut _T { 454 type Data = _T::Data; 455 fn f1( 456 store: wasmtime::StoreContextMut<'_, Self::Data>, 457 ) -> impl ::core::future::Future< 458 Output = impl FnOnce( 459 wasmtime::StoreContextMut<'_, Self::Data>, 460 ) -> () + Send + Sync + 'static, 461 > + Send + Sync + 'static 462 where 463 Self: Sized, 464 { 465 <_T as Host>::f1(store) 466 } 467 fn f2( 468 store: wasmtime::StoreContextMut<'_, Self::Data>, 469 a: u32, 470 ) -> impl ::core::future::Future< 471 Output = impl FnOnce( 472 wasmtime::StoreContextMut<'_, Self::Data>, 473 ) -> () + Send + Sync + 'static, 474 > + Send + Sync + 'static 475 where 476 Self: Sized, 477 { 478 <_T as Host>::f2(store, a) 479 } 480 fn f3( 481 store: wasmtime::StoreContextMut<'_, Self::Data>, 482 a: u32, 483 b: u32, 484 ) -> impl ::core::future::Future< 485 Output = impl FnOnce( 486 wasmtime::StoreContextMut<'_, Self::Data>, 487 ) -> () + Send + Sync + 'static, 488 > + Send + Sync + 'static 489 where 490 Self: Sized, 491 { 492 <_T as Host>::f3(store, a, b) 493 } 494 fn f4( 495 store: wasmtime::StoreContextMut<'_, Self::Data>, 496 ) -> impl ::core::future::Future< 497 Output = impl FnOnce( 498 wasmtime::StoreContextMut<'_, Self::Data>, 499 ) -> u32 + Send + Sync + 'static, 500 > + Send + Sync + 'static 501 where 502 Self: Sized, 503 { 504 <_T as Host>::f4(store) 505 } 506 fn f5( 507 store: wasmtime::StoreContextMut<'_, Self::Data>, 508 ) -> impl ::core::future::Future< 509 Output = impl FnOnce( 510 wasmtime::StoreContextMut<'_, Self::Data>, 511 ) -> (u32, u32) + Send + Sync + 'static, 512 > + Send + Sync + 'static 513 where 514 Self: Sized, 515 { 516 <_T as Host>::f5(store) 517 } 518 fn f6( 519 store: wasmtime::StoreContextMut<'_, Self::Data>, 520 a: u32, 521 b: u32, 522 c: u32, 523 ) -> impl ::core::future::Future< 524 Output = impl FnOnce( 525 wasmtime::StoreContextMut<'_, Self::Data>, 526 ) -> (u32, u32, u32) + Send + Sync + 'static, 527 > + Send + Sync + 'static 528 where 529 Self: Sized, 530 { 531 <_T as Host>::f6(store, a, b, c) 532 } 533 } 534 } 535 } 536 } 537 pub mod exports { 538 pub mod foo { 539 pub mod foo { 540 #[allow(clippy::all)] 541 pub mod simple { 542 #[allow(unused_imports)] 543 use wasmtime::component::__internal::{anyhow, Box}; 544 pub struct Guest { 545 f1: wasmtime::component::Func, 546 f2: wasmtime::component::Func, 547 f3: wasmtime::component::Func, 548 f4: wasmtime::component::Func, 549 f5: wasmtime::component::Func, 550 f6: wasmtime::component::Func, 551 } 552 #[derive(Clone)] 553 pub struct GuestIndices { 554 f1: wasmtime::component::ComponentExportIndex, 555 f2: wasmtime::component::ComponentExportIndex, 556 f3: wasmtime::component::ComponentExportIndex, 557 f4: wasmtime::component::ComponentExportIndex, 558 f5: wasmtime::component::ComponentExportIndex, 559 f6: wasmtime::component::ComponentExportIndex, 560 } 561 impl GuestIndices { 562 /// Constructor for [`GuestIndices`] which takes a 563 /// [`Component`](wasmtime::component::Component) as input and can be executed 564 /// before instantiation. 565 /// 566 /// This constructor can be used to front-load string lookups to find exports 567 /// within a component. 568 pub fn new<_T>( 569 _instance_pre: &wasmtime::component::InstancePre<_T>, 570 ) -> wasmtime::Result<GuestIndices> { 571 let instance = _instance_pre 572 .component() 573 .get_export_index(None, "foo:foo/simple") 574 .ok_or_else(|| { 575 anyhow::anyhow!( 576 "no exported instance named `foo:foo/simple`" 577 ) 578 })?; 579 let mut lookup = move |name| { 580 _instance_pre 581 .component() 582 .get_export_index(Some(&instance), name) 583 .ok_or_else(|| { 584 anyhow::anyhow!( 585 "instance export `foo:foo/simple` does \ 586 not have export `{name}`" 587 ) 588 }) 589 }; 590 let _ = &mut lookup; 591 let f1 = lookup("f1")?; 592 let f2 = lookup("f2")?; 593 let f3 = lookup("f3")?; 594 let f4 = lookup("f4")?; 595 let f5 = lookup("f5")?; 596 let f6 = lookup("f6")?; 597 Ok(GuestIndices { 598 f1, 599 f2, 600 f3, 601 f4, 602 f5, 603 f6, 604 }) 605 } 606 pub fn load( 607 &self, 608 mut store: impl wasmtime::AsContextMut, 609 instance: &wasmtime::component::Instance, 610 ) -> wasmtime::Result<Guest> { 611 let _instance = instance; 612 let _instance_pre = _instance.instance_pre(&store); 613 let _instance_type = _instance_pre.instance_type(); 614 let mut store = store.as_context_mut(); 615 let _ = &mut store; 616 let f1 = *_instance 617 .get_typed_func::<(), ()>(&mut store, &self.f1)? 618 .func(); 619 let f2 = *_instance 620 .get_typed_func::<(u32,), ()>(&mut store, &self.f2)? 621 .func(); 622 let f3 = *_instance 623 .get_typed_func::<(u32, u32), ()>(&mut store, &self.f3)? 624 .func(); 625 let f4 = *_instance 626 .get_typed_func::<(), (u32,)>(&mut store, &self.f4)? 627 .func(); 628 let f5 = *_instance 629 .get_typed_func::<(), ((u32, u32),)>(&mut store, &self.f5)? 630 .func(); 631 let f6 = *_instance 632 .get_typed_func::< 633 (u32, u32, u32), 634 ((u32, u32, u32),), 635 >(&mut store, &self.f6)? 636 .func(); 637 Ok(Guest { f1, f2, f3, f4, f5, f6 }) 638 } 639 } 640 impl Guest { 641 pub async fn call_f1<S: wasmtime::AsContextMut>( 642 &self, 643 mut store: S, 644 ) -> wasmtime::Result<wasmtime::component::Promise<()>> 645 where 646 <S as wasmtime::AsContext>::Data: Send + 'static, 647 { 648 let callee = unsafe { 649 wasmtime::component::TypedFunc::< 650 (), 651 (), 652 >::new_unchecked(self.f1) 653 }; 654 let promise = callee 655 .call_concurrent(store.as_context_mut(), ()) 656 .await?; 657 Ok(promise) 658 } 659 pub async fn call_f2<S: wasmtime::AsContextMut>( 660 &self, 661 mut store: S, 662 arg0: u32, 663 ) -> wasmtime::Result<wasmtime::component::Promise<()>> 664 where 665 <S as wasmtime::AsContext>::Data: Send + 'static, 666 { 667 let callee = unsafe { 668 wasmtime::component::TypedFunc::< 669 (u32,), 670 (), 671 >::new_unchecked(self.f2) 672 }; 673 let promise = callee 674 .call_concurrent(store.as_context_mut(), (arg0,)) 675 .await?; 676 Ok(promise) 677 } 678 pub async fn call_f3<S: wasmtime::AsContextMut>( 679 &self, 680 mut store: S, 681 arg0: u32, 682 arg1: u32, 683 ) -> wasmtime::Result<wasmtime::component::Promise<()>> 684 where 685 <S as wasmtime::AsContext>::Data: Send + 'static, 686 { 687 let callee = unsafe { 688 wasmtime::component::TypedFunc::< 689 (u32, u32), 690 (), 691 >::new_unchecked(self.f3) 692 }; 693 let promise = callee 694 .call_concurrent(store.as_context_mut(), (arg0, arg1)) 695 .await?; 696 Ok(promise) 697 } 698 pub async fn call_f4<S: wasmtime::AsContextMut>( 699 &self, 700 mut store: S, 701 ) -> wasmtime::Result<wasmtime::component::Promise<u32>> 702 where 703 <S as wasmtime::AsContext>::Data: Send + 'static, 704 { 705 let callee = unsafe { 706 wasmtime::component::TypedFunc::< 707 (), 708 (u32,), 709 >::new_unchecked(self.f4) 710 }; 711 let promise = callee 712 .call_concurrent(store.as_context_mut(), ()) 713 .await?; 714 Ok(promise.map(|(v,)| v)) 715 } 716 pub async fn call_f5<S: wasmtime::AsContextMut>( 717 &self, 718 mut store: S, 719 ) -> wasmtime::Result<wasmtime::component::Promise<(u32, u32)>> 720 where 721 <S as wasmtime::AsContext>::Data: Send + 'static, 722 { 723 let callee = unsafe { 724 wasmtime::component::TypedFunc::< 725 (), 726 ((u32, u32),), 727 >::new_unchecked(self.f5) 728 }; 729 let promise = callee 730 .call_concurrent(store.as_context_mut(), ()) 731 .await?; 732 Ok(promise.map(|(v,)| v)) 733 } 734 pub async fn call_f6<S: wasmtime::AsContextMut>( 735 &self, 736 mut store: S, 737 arg0: u32, 738 arg1: u32, 739 arg2: u32, 740 ) -> wasmtime::Result<wasmtime::component::Promise<(u32, u32, u32)>> 741 where 742 <S as wasmtime::AsContext>::Data: Send + 'static, 743 { 744 let callee = unsafe { 745 wasmtime::component::TypedFunc::< 746 (u32, u32, u32), 747 ((u32, u32, u32),), 748 >::new_unchecked(self.f6) 749 }; 750 let promise = callee 751 .call_concurrent(store.as_context_mut(), (arg0, arg1, arg2)) 752 .await?; 753 Ok(promise.map(|(v,)| v)) 754 } 755 } 756 } 757 } 758 } 759 } 760