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> { clone(&self) -> Self14 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. new( instance_pre: wasmtime::component::InstancePre<_T>, ) -> wasmtime::Result<Self>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 } engine(&self) -> &wasmtime::Engine33 pub fn engine(&self) -> &wasmtime::Engine { 34 self.instance_pre.engine() 35 } instance_pre(&self) -> &wasmtime::component::InstancePre<_T>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. instantiate( &self, mut store: impl wasmtime::AsContextMut<Data = _T>, ) -> wasmtime::Result<TheWorld>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`. instantiate_async( &self, mut store: impl wasmtime::AsContextMut<Data = _T>, ) -> wasmtime::Result<TheWorld>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::simple::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::simple::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. new<_T>( _instance_pre: &wasmtime::component::InstancePre<_T>, ) -> wasmtime::Result<Self>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::simple::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. load( &self, mut store: impl wasmtime::AsContextMut, instance: &wasmtime::component::Instance, ) -> wasmtime::Result<TheWorld>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`]. instantiate<_T>( store: impl wasmtime::AsContextMut<Data = _T>, component: &wasmtime::component::Component, linker: &wasmtime::component::Linker<_T>, ) -> wasmtime::Result<TheWorld>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`]. new( mut store: impl wasmtime::AsContextMut, instance: &wasmtime::component::Instance, ) -> wasmtime::Result<TheWorld>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`]. instantiate_async<_T>( store: impl wasmtime::AsContextMut<Data = _T>, component: &wasmtime::component::Component, linker: &wasmtime::component::Linker<_T>, ) -> wasmtime::Result<TheWorld> where _T: Send,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 } add_to_linker<T, D>( linker: &mut wasmtime::component::Linker<T>, host_getter: fn(&mut T) -> D::Data<'_>, ) -> wasmtime::Result<()> where D: foo::foo::simple::HostWithStore + Send, for<'a> D::Data<'a>: foo::foo::simple::Host + Send, T: 'static + Send,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::simple::HostWithStore + Send, 177 for<'a> D::Data<'a>: foo::foo::simple::Host + Send, 178 T: 'static + Send, 179 { 180 foo::foo::simple::add_to_linker::<T, D>(linker, host_getter)?; 181 Ok(()) 182 } foo_foo_simple(&self) -> &exports::foo::foo::simple::Guest183 pub fn foo_foo_simple(&self) -> &exports::foo::foo::simple::Guest { 184 &self.interface0 185 } 186 } 187 }; 188 pub mod foo { 189 pub mod foo { 190 #[allow(clippy::all)] 191 pub mod simple { 192 #[allow(unused_imports)] 193 use wasmtime::component::__internal::Box; 194 pub trait HostWithStore: wasmtime::component::HasData + Send {} 195 impl<_T: ?Sized> HostWithStore for _T 196 where 197 _T: wasmtime::component::HasData + Send, 198 {} 199 pub trait Host: Send { f1(&mut self) -> impl ::core::future::Future<Output = ()> + Send200 fn f1(&mut self) -> impl ::core::future::Future<Output = ()> + Send; f2( &mut self, a: u32, ) -> impl ::core::future::Future<Output = ()> + Send201 fn f2( 202 &mut self, 203 a: u32, 204 ) -> impl ::core::future::Future<Output = ()> + Send; f3( &mut self, a: u32, b: u32, ) -> impl ::core::future::Future<Output = ()> + Send205 fn f3( 206 &mut self, 207 a: u32, 208 b: u32, 209 ) -> impl ::core::future::Future<Output = ()> + Send; f4(&mut self) -> impl ::core::future::Future<Output = u32> + Send210 fn f4(&mut self) -> impl ::core::future::Future<Output = u32> + Send; f5( &mut self, ) -> impl ::core::future::Future<Output = (u32, u32)> + Send211 fn f5( 212 &mut self, 213 ) -> impl ::core::future::Future<Output = (u32, u32)> + Send; f6( &mut self, a: u32, b: u32, c: u32, ) -> impl ::core::future::Future<Output = (u32, u32, u32)> + Send214 fn f6( 215 &mut self, 216 a: u32, 217 b: u32, 218 c: u32, 219 ) -> impl ::core::future::Future<Output = (u32, u32, u32)> + Send; 220 } 221 impl<_T: Host + ?Sized + Send> Host for &mut _T { f1(&mut self) -> impl ::core::future::Future<Output = ()> + Send222 fn f1(&mut self) -> impl ::core::future::Future<Output = ()> + Send { 223 async move { Host::f1(*self).await } 224 } f2( &mut self, a: u32, ) -> impl ::core::future::Future<Output = ()> + Send225 fn f2( 226 &mut self, 227 a: u32, 228 ) -> impl ::core::future::Future<Output = ()> + Send { 229 async move { Host::f2(*self, a).await } 230 } f3( &mut self, a: u32, b: u32, ) -> impl ::core::future::Future<Output = ()> + Send231 fn f3( 232 &mut self, 233 a: u32, 234 b: u32, 235 ) -> impl ::core::future::Future<Output = ()> + Send { 236 async move { Host::f3(*self, a, b).await } 237 } f4(&mut self) -> impl ::core::future::Future<Output = u32> + Send238 fn f4(&mut self) -> impl ::core::future::Future<Output = u32> + Send { 239 async move { Host::f4(*self).await } 240 } f5( &mut self, ) -> impl ::core::future::Future<Output = (u32, u32)> + Send241 fn f5( 242 &mut self, 243 ) -> impl ::core::future::Future<Output = (u32, u32)> + Send { 244 async move { Host::f5(*self).await } 245 } f6( &mut self, a: u32, b: u32, c: u32, ) -> impl ::core::future::Future<Output = (u32, u32, u32)> + Send246 fn f6( 247 &mut self, 248 a: u32, 249 b: u32, 250 c: u32, 251 ) -> impl ::core::future::Future<Output = (u32, u32, u32)> + Send { 252 async move { Host::f6(*self, a, b, c).await } 253 } 254 } add_to_linker<T, D>( linker: &mut wasmtime::component::Linker<T>, host_getter: fn(&mut T) -> D::Data<'_>, ) -> wasmtime::Result<()> where D: HostWithStore, for<'a> D::Data<'a>: Host, T: 'static + Send,255 pub fn add_to_linker<T, D>( 256 linker: &mut wasmtime::component::Linker<T>, 257 host_getter: fn(&mut T) -> D::Data<'_>, 258 ) -> wasmtime::Result<()> 259 where 260 D: HostWithStore, 261 for<'a> D::Data<'a>: Host, 262 T: 'static + Send, 263 { 264 let mut inst = linker.instance("foo:foo/simple")?; 265 inst.func_wrap_async( 266 "f1", 267 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 268 use tracing::Instrument; 269 let span = tracing::span!( 270 tracing::Level::TRACE, "wit-bindgen import", module = 271 "simple", function = "f1", 272 ); 273 wasmtime::component::__internal::Box::new( 274 async move { 275 tracing::event!(tracing::Level::TRACE, "call"); 276 let host = &mut host_getter(caller.data_mut()); 277 let r = Host::f1(host).await; 278 tracing::event!( 279 tracing::Level::TRACE, result = tracing::field::debug(& r), 280 "return" 281 ); 282 Ok(r) 283 } 284 .instrument(span), 285 ) 286 }, 287 )?; 288 inst.func_wrap_async( 289 "f2", 290 move |mut caller: wasmtime::StoreContextMut<'_, T>, (arg0,): (u32,)| { 291 use tracing::Instrument; 292 let span = tracing::span!( 293 tracing::Level::TRACE, "wit-bindgen import", module = 294 "simple", function = "f2", 295 ); 296 wasmtime::component::__internal::Box::new( 297 async move { 298 tracing::event!( 299 tracing::Level::TRACE, a = tracing::field::debug(& arg0), 300 "call" 301 ); 302 let host = &mut host_getter(caller.data_mut()); 303 let r = Host::f2(host, arg0).await; 304 tracing::event!( 305 tracing::Level::TRACE, result = tracing::field::debug(& r), 306 "return" 307 ); 308 Ok(r) 309 } 310 .instrument(span), 311 ) 312 }, 313 )?; 314 inst.func_wrap_async( 315 "f3", 316 move | 317 mut caller: wasmtime::StoreContextMut<'_, T>, 318 (arg0, arg1): (u32, u32)| 319 { 320 use tracing::Instrument; 321 let span = tracing::span!( 322 tracing::Level::TRACE, "wit-bindgen import", module = 323 "simple", function = "f3", 324 ); 325 wasmtime::component::__internal::Box::new( 326 async move { 327 tracing::event!( 328 tracing::Level::TRACE, a = tracing::field::debug(& arg0), b 329 = tracing::field::debug(& arg1), "call" 330 ); 331 let host = &mut host_getter(caller.data_mut()); 332 let r = Host::f3(host, arg0, arg1).await; 333 tracing::event!( 334 tracing::Level::TRACE, result = tracing::field::debug(& r), 335 "return" 336 ); 337 Ok(r) 338 } 339 .instrument(span), 340 ) 341 }, 342 )?; 343 inst.func_wrap_async( 344 "f4", 345 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 346 use tracing::Instrument; 347 let span = tracing::span!( 348 tracing::Level::TRACE, "wit-bindgen import", module = 349 "simple", function = "f4", 350 ); 351 wasmtime::component::__internal::Box::new( 352 async move { 353 tracing::event!(tracing::Level::TRACE, "call"); 354 let host = &mut host_getter(caller.data_mut()); 355 let r = Host::f4(host).await; 356 tracing::event!( 357 tracing::Level::TRACE, result = tracing::field::debug(& r), 358 "return" 359 ); 360 Ok((r,)) 361 } 362 .instrument(span), 363 ) 364 }, 365 )?; 366 inst.func_wrap_async( 367 "f5", 368 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 369 use tracing::Instrument; 370 let span = tracing::span!( 371 tracing::Level::TRACE, "wit-bindgen import", module = 372 "simple", function = "f5", 373 ); 374 wasmtime::component::__internal::Box::new( 375 async move { 376 tracing::event!(tracing::Level::TRACE, "call"); 377 let host = &mut host_getter(caller.data_mut()); 378 let r = Host::f5(host).await; 379 tracing::event!( 380 tracing::Level::TRACE, result = tracing::field::debug(& r), 381 "return" 382 ); 383 Ok((r,)) 384 } 385 .instrument(span), 386 ) 387 }, 388 )?; 389 inst.func_wrap_async( 390 "f6", 391 move | 392 mut caller: wasmtime::StoreContextMut<'_, T>, 393 (arg0, arg1, arg2): (u32, u32, u32)| 394 { 395 use tracing::Instrument; 396 let span = tracing::span!( 397 tracing::Level::TRACE, "wit-bindgen import", module = 398 "simple", function = "f6", 399 ); 400 wasmtime::component::__internal::Box::new( 401 async move { 402 tracing::event!( 403 tracing::Level::TRACE, a = tracing::field::debug(& arg0), b 404 = tracing::field::debug(& arg1), c = tracing::field::debug(& 405 arg2), "call" 406 ); 407 let host = &mut host_getter(caller.data_mut()); 408 let r = Host::f6(host, arg0, arg1, arg2).await; 409 tracing::event!( 410 tracing::Level::TRACE, result = tracing::field::debug(& r), 411 "return" 412 ); 413 Ok((r,)) 414 } 415 .instrument(span), 416 ) 417 }, 418 )?; 419 Ok(()) 420 } 421 } 422 } 423 } 424 pub mod exports { 425 pub mod foo { 426 pub mod foo { 427 #[allow(clippy::all)] 428 pub mod simple { 429 #[allow(unused_imports)] 430 use wasmtime::component::__internal::Box; 431 #[derive(Clone)] 432 pub struct Guest { 433 f1: wasmtime::component::Func, 434 f2: wasmtime::component::Func, 435 f3: wasmtime::component::Func, 436 f4: wasmtime::component::Func, 437 f5: wasmtime::component::Func, 438 f6: wasmtime::component::Func, 439 } 440 #[derive(Clone)] 441 pub struct GuestIndices { 442 f1: wasmtime::component::ComponentExportIndex, 443 f2: wasmtime::component::ComponentExportIndex, 444 f3: wasmtime::component::ComponentExportIndex, 445 f4: wasmtime::component::ComponentExportIndex, 446 f5: wasmtime::component::ComponentExportIndex, 447 f6: wasmtime::component::ComponentExportIndex, 448 } 449 impl GuestIndices { 450 /// Constructor for [`GuestIndices`] which takes a 451 /// [`Component`](wasmtime::component::Component) as input and can be executed 452 /// before instantiation. 453 /// 454 /// This constructor can be used to front-load string lookups to find exports 455 /// within a component. new<_T>( _instance_pre: &wasmtime::component::InstancePre<_T>, ) -> wasmtime::Result<GuestIndices>456 pub fn new<_T>( 457 _instance_pre: &wasmtime::component::InstancePre<_T>, 458 ) -> wasmtime::Result<GuestIndices> { 459 let instance = _instance_pre 460 .component() 461 .get_export_index(None, "foo:foo/simple") 462 .ok_or_else(|| { 463 wasmtime::format_err!( 464 "no exported instance named `foo:foo/simple`" 465 ) 466 })?; 467 let mut lookup = move |name| { 468 _instance_pre 469 .component() 470 .get_export_index(Some(&instance), name) 471 .ok_or_else(|| { 472 wasmtime::format_err!( 473 "instance export `foo:foo/simple` does \ 474 not have export `{name}`" 475 ) 476 }) 477 }; 478 let _ = &mut lookup; 479 let f1 = lookup("f1")?; 480 let f2 = lookup("f2")?; 481 let f3 = lookup("f3")?; 482 let f4 = lookup("f4")?; 483 let f5 = lookup("f5")?; 484 let f6 = lookup("f6")?; 485 Ok(GuestIndices { 486 f1, 487 f2, 488 f3, 489 f4, 490 f5, 491 f6, 492 }) 493 } load( &self, mut store: impl wasmtime::AsContextMut, instance: &wasmtime::component::Instance, ) -> wasmtime::Result<Guest>494 pub fn load( 495 &self, 496 mut store: impl wasmtime::AsContextMut, 497 instance: &wasmtime::component::Instance, 498 ) -> wasmtime::Result<Guest> { 499 let _instance = instance; 500 let _instance_pre = _instance.instance_pre(&store); 501 let _instance_type = _instance_pre.instance_type(); 502 let mut store = store.as_context_mut(); 503 let _ = &mut store; 504 let f1 = *_instance 505 .get_typed_func::<(), ()>(&mut store, &self.f1)? 506 .func(); 507 let f2 = *_instance 508 .get_typed_func::<(u32,), ()>(&mut store, &self.f2)? 509 .func(); 510 let f3 = *_instance 511 .get_typed_func::<(u32, u32), ()>(&mut store, &self.f3)? 512 .func(); 513 let f4 = *_instance 514 .get_typed_func::<(), (u32,)>(&mut store, &self.f4)? 515 .func(); 516 let f5 = *_instance 517 .get_typed_func::<(), ((u32, u32),)>(&mut store, &self.f5)? 518 .func(); 519 let f6 = *_instance 520 .get_typed_func::< 521 (u32, u32, u32), 522 ((u32, u32, u32),), 523 >(&mut store, &self.f6)? 524 .func(); 525 Ok(Guest { f1, f2, f3, f4, f5, f6 }) 526 } 527 } 528 impl Guest { call_f1<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,529 pub async fn call_f1<S: wasmtime::AsContextMut>( 530 &self, 531 mut store: S, 532 ) -> wasmtime::Result<()> 533 where 534 <S as wasmtime::AsContext>::Data: Send, 535 { 536 use tracing::Instrument; 537 let span = tracing::span!( 538 tracing::Level::TRACE, "wit-bindgen export", module = 539 "foo:foo/simple", function = "f1", 540 ); 541 let callee = unsafe { 542 wasmtime::component::TypedFunc::< 543 (), 544 (), 545 >::new_unchecked(self.f1) 546 }; 547 let () = callee 548 .call_async(store.as_context_mut(), ()) 549 .instrument(span.clone()) 550 .await?; 551 Ok(()) 552 } call_f2<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: u32, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,553 pub async fn call_f2<S: wasmtime::AsContextMut>( 554 &self, 555 mut store: S, 556 arg0: u32, 557 ) -> wasmtime::Result<()> 558 where 559 <S as wasmtime::AsContext>::Data: Send, 560 { 561 use tracing::Instrument; 562 let span = tracing::span!( 563 tracing::Level::TRACE, "wit-bindgen export", module = 564 "foo:foo/simple", function = "f2", 565 ); 566 let callee = unsafe { 567 wasmtime::component::TypedFunc::< 568 (u32,), 569 (), 570 >::new_unchecked(self.f2) 571 }; 572 let () = callee 573 .call_async(store.as_context_mut(), (arg0,)) 574 .instrument(span.clone()) 575 .await?; 576 Ok(()) 577 } call_f3<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: u32, arg1: u32, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,578 pub async fn call_f3<S: wasmtime::AsContextMut>( 579 &self, 580 mut store: S, 581 arg0: u32, 582 arg1: u32, 583 ) -> wasmtime::Result<()> 584 where 585 <S as wasmtime::AsContext>::Data: Send, 586 { 587 use tracing::Instrument; 588 let span = tracing::span!( 589 tracing::Level::TRACE, "wit-bindgen export", module = 590 "foo:foo/simple", function = "f3", 591 ); 592 let callee = unsafe { 593 wasmtime::component::TypedFunc::< 594 (u32, u32), 595 (), 596 >::new_unchecked(self.f3) 597 }; 598 let () = callee 599 .call_async(store.as_context_mut(), (arg0, arg1)) 600 .instrument(span.clone()) 601 .await?; 602 Ok(()) 603 } call_f4<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<u32> where <S as wasmtime::AsContext>::Data: Send,604 pub async fn call_f4<S: wasmtime::AsContextMut>( 605 &self, 606 mut store: S, 607 ) -> wasmtime::Result<u32> 608 where 609 <S as wasmtime::AsContext>::Data: Send, 610 { 611 use tracing::Instrument; 612 let span = tracing::span!( 613 tracing::Level::TRACE, "wit-bindgen export", module = 614 "foo:foo/simple", function = "f4", 615 ); 616 let callee = unsafe { 617 wasmtime::component::TypedFunc::< 618 (), 619 (u32,), 620 >::new_unchecked(self.f4) 621 }; 622 let (ret0,) = callee 623 .call_async(store.as_context_mut(), ()) 624 .instrument(span.clone()) 625 .await?; 626 Ok(ret0) 627 } call_f5<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<(u32, u32)> where <S as wasmtime::AsContext>::Data: Send,628 pub async fn call_f5<S: wasmtime::AsContextMut>( 629 &self, 630 mut store: S, 631 ) -> wasmtime::Result<(u32, u32)> 632 where 633 <S as wasmtime::AsContext>::Data: Send, 634 { 635 use tracing::Instrument; 636 let span = tracing::span!( 637 tracing::Level::TRACE, "wit-bindgen export", module = 638 "foo:foo/simple", function = "f5", 639 ); 640 let callee = unsafe { 641 wasmtime::component::TypedFunc::< 642 (), 643 ((u32, u32),), 644 >::new_unchecked(self.f5) 645 }; 646 let (ret0,) = callee 647 .call_async(store.as_context_mut(), ()) 648 .instrument(span.clone()) 649 .await?; 650 Ok(ret0) 651 } call_f6<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: u32, arg1: u32, arg2: u32, ) -> wasmtime::Result<(u32, u32, u32)> where <S as wasmtime::AsContext>::Data: Send,652 pub async fn call_f6<S: wasmtime::AsContextMut>( 653 &self, 654 mut store: S, 655 arg0: u32, 656 arg1: u32, 657 arg2: u32, 658 ) -> wasmtime::Result<(u32, u32, u32)> 659 where 660 <S as wasmtime::AsContext>::Data: Send, 661 { 662 use tracing::Instrument; 663 let span = tracing::span!( 664 tracing::Level::TRACE, "wit-bindgen export", module = 665 "foo:foo/simple", function = "f6", 666 ); 667 let callee = unsafe { 668 wasmtime::component::TypedFunc::< 669 (u32, u32, u32), 670 ((u32, u32, u32),), 671 >::new_unchecked(self.f6) 672 }; 673 let (ret0,) = callee 674 .call_async(store.as_context_mut(), (arg0, arg1, arg2)) 675 .instrument(span.clone()) 676 .await?; 677 Ok(ret0) 678 } 679 } 680 } 681 } 682 } 683 } 684