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::records::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::records::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::records::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::records::HostWithStore + Send, for<'a> D::Data<'a>: foo::foo::records::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::records::HostWithStore + Send, 177 for<'a> D::Data<'a>: foo::foo::records::Host + Send, 178 T: 'static + Send, 179 { 180 foo::foo::records::add_to_linker::<T, D>(linker, host_getter)?; 181 Ok(()) 182 } foo_foo_records(&self) -> &exports::foo::foo::records::Guest183 pub fn foo_foo_records(&self) -> &exports::foo::foo::records::Guest { 184 &self.interface0 185 } 186 } 187 }; 188 pub mod foo { 189 pub mod foo { 190 #[allow(clippy::all)] 191 pub mod records { 192 #[allow(unused_imports)] 193 use wasmtime::component::__internal::Box; 194 #[derive(wasmtime::component::ComponentType)] 195 #[derive(wasmtime::component::Lift)] 196 #[derive(wasmtime::component::Lower)] 197 #[component(record)] 198 #[derive(Clone, Copy)] 199 pub struct Empty {} 200 impl core::fmt::Debug for Empty { fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result201 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 202 f.debug_struct("Empty").finish() 203 } 204 } 205 const _: () = { 206 assert!(0 == < Empty as wasmtime::component::ComponentType >::SIZE32); 207 assert!(1 == < Empty as wasmtime::component::ComponentType >::ALIGN32); 208 }; 209 /// A record containing two scalar fields 210 /// that both have the same type 211 #[derive(wasmtime::component::ComponentType)] 212 #[derive(wasmtime::component::Lift)] 213 #[derive(wasmtime::component::Lower)] 214 #[component(record)] 215 #[derive(Clone, Copy)] 216 pub struct Scalars { 217 /// The first field, named a 218 #[component(name = "a")] 219 pub a: u32, 220 /// The second field, named b 221 #[component(name = "b")] 222 pub b: u32, 223 } 224 impl core::fmt::Debug for Scalars { fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result225 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 226 f.debug_struct("Scalars") 227 .field("a", &self.a) 228 .field("b", &self.b) 229 .finish() 230 } 231 } 232 const _: () = { 233 assert!(8 == < Scalars as wasmtime::component::ComponentType >::SIZE32); 234 assert!(4 == < Scalars as wasmtime::component::ComponentType >::ALIGN32); 235 }; 236 /// A record that is really just flags 237 /// All of the fields are bool 238 #[derive(wasmtime::component::ComponentType)] 239 #[derive(wasmtime::component::Lift)] 240 #[derive(wasmtime::component::Lower)] 241 #[component(record)] 242 #[derive(Clone, Copy)] 243 pub struct ReallyFlags { 244 #[component(name = "a")] 245 pub a: bool, 246 #[component(name = "b")] 247 pub b: bool, 248 #[component(name = "c")] 249 pub c: bool, 250 #[component(name = "d")] 251 pub d: bool, 252 #[component(name = "e")] 253 pub e: bool, 254 #[component(name = "f")] 255 pub f: bool, 256 #[component(name = "g")] 257 pub g: bool, 258 #[component(name = "h")] 259 pub h: bool, 260 #[component(name = "i")] 261 pub i: bool, 262 } 263 impl core::fmt::Debug for ReallyFlags { fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result264 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 265 f.debug_struct("ReallyFlags") 266 .field("a", &self.a) 267 .field("b", &self.b) 268 .field("c", &self.c) 269 .field("d", &self.d) 270 .field("e", &self.e) 271 .field("f", &self.f) 272 .field("g", &self.g) 273 .field("h", &self.h) 274 .field("i", &self.i) 275 .finish() 276 } 277 } 278 const _: () = { 279 assert!( 280 9 == < ReallyFlags as wasmtime::component::ComponentType >::SIZE32 281 ); 282 assert!( 283 1 == < ReallyFlags as wasmtime::component::ComponentType >::ALIGN32 284 ); 285 }; 286 #[derive(wasmtime::component::ComponentType)] 287 #[derive(wasmtime::component::Lift)] 288 #[derive(wasmtime::component::Lower)] 289 #[component(record)] 290 #[derive(Clone)] 291 pub struct Aggregates { 292 #[component(name = "a")] 293 pub a: Scalars, 294 #[component(name = "b")] 295 pub b: u32, 296 #[component(name = "c")] 297 pub c: Empty, 298 #[component(name = "d")] 299 pub d: wasmtime::component::__internal::String, 300 #[component(name = "e")] 301 pub e: ReallyFlags, 302 } 303 impl core::fmt::Debug for Aggregates { fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result304 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 305 f.debug_struct("Aggregates") 306 .field("a", &self.a) 307 .field("b", &self.b) 308 .field("c", &self.c) 309 .field("d", &self.d) 310 .field("e", &self.e) 311 .finish() 312 } 313 } 314 const _: () = { 315 assert!( 316 32 == < Aggregates as wasmtime::component::ComponentType >::SIZE32 317 ); 318 assert!( 319 4 == < Aggregates as wasmtime::component::ComponentType >::ALIGN32 320 ); 321 }; 322 pub type TupleTypedef = (i32,); 323 const _: () = { 324 assert!( 325 4 == < TupleTypedef as wasmtime::component::ComponentType >::SIZE32 326 ); 327 assert!( 328 4 == < TupleTypedef as wasmtime::component::ComponentType >::ALIGN32 329 ); 330 }; 331 pub type IntTypedef = i32; 332 const _: () = { 333 assert!( 334 4 == < IntTypedef as wasmtime::component::ComponentType >::SIZE32 335 ); 336 assert!( 337 4 == < IntTypedef as wasmtime::component::ComponentType >::ALIGN32 338 ); 339 }; 340 pub type TupleTypedef2 = (IntTypedef,); 341 const _: () = { 342 assert!( 343 4 == < TupleTypedef2 as wasmtime::component::ComponentType >::SIZE32 344 ); 345 assert!( 346 4 == < TupleTypedef2 as wasmtime::component::ComponentType >::ALIGN32 347 ); 348 }; 349 #[derive(wasmtime::component::ComponentType)] 350 #[derive(wasmtime::component::Lift)] 351 #[derive(wasmtime::component::Lower)] 352 #[component(record)] 353 pub struct FuturesAndStreams { 354 #[component(name = "a")] 355 pub a: wasmtime::component::FutureReader<u8>, 356 #[component(name = "b")] 357 pub b: wasmtime::component::StreamReader<u8>, 358 #[component(name = "c")] 359 pub c: wasmtime::component::StreamReader< 360 wasmtime::component::FutureReader< 361 wasmtime::component::StreamReader<()>, 362 >, 363 >, 364 #[component(name = "d")] 365 pub d: wasmtime::component::FutureReader< 366 wasmtime::component::StreamReader< 367 wasmtime::component::FutureReader<()>, 368 >, 369 >, 370 } 371 impl core::fmt::Debug for FuturesAndStreams { fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result372 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 373 f.debug_struct("FuturesAndStreams") 374 .field("a", &self.a) 375 .field("b", &self.b) 376 .field("c", &self.c) 377 .field("d", &self.d) 378 .finish() 379 } 380 } 381 const _: () = { 382 assert!( 383 16 == < FuturesAndStreams as wasmtime::component::ComponentType 384 >::SIZE32 385 ); 386 assert!( 387 4 == < FuturesAndStreams as wasmtime::component::ComponentType 388 >::ALIGN32 389 ); 390 }; 391 pub trait HostWithStore: wasmtime::component::HasData + Send {} 392 impl<_T: ?Sized> HostWithStore for _T 393 where 394 _T: wasmtime::component::HasData + Send, 395 {} 396 pub trait Host: Send { tuple_arg( &mut self, x: (char, u32), ) -> impl ::core::future::Future<Output = ()> + Send397 fn tuple_arg( 398 &mut self, 399 x: (char, u32), 400 ) -> impl ::core::future::Future<Output = ()> + Send; tuple_result( &mut self, ) -> impl ::core::future::Future<Output = (char, u32)> + Send401 fn tuple_result( 402 &mut self, 403 ) -> impl ::core::future::Future<Output = (char, u32)> + Send; empty_arg( &mut self, x: Empty, ) -> impl ::core::future::Future<Output = ()> + Send404 fn empty_arg( 405 &mut self, 406 x: Empty, 407 ) -> impl ::core::future::Future<Output = ()> + Send; empty_result( &mut self, ) -> impl ::core::future::Future<Output = Empty> + Send408 fn empty_result( 409 &mut self, 410 ) -> impl ::core::future::Future<Output = Empty> + Send; scalar_arg( &mut self, x: Scalars, ) -> impl ::core::future::Future<Output = ()> + Send411 fn scalar_arg( 412 &mut self, 413 x: Scalars, 414 ) -> impl ::core::future::Future<Output = ()> + Send; scalar_result( &mut self, ) -> impl ::core::future::Future<Output = Scalars> + Send415 fn scalar_result( 416 &mut self, 417 ) -> impl ::core::future::Future<Output = Scalars> + Send; flags_arg( &mut self, x: ReallyFlags, ) -> impl ::core::future::Future<Output = ()> + Send418 fn flags_arg( 419 &mut self, 420 x: ReallyFlags, 421 ) -> impl ::core::future::Future<Output = ()> + Send; flags_result( &mut self, ) -> impl ::core::future::Future<Output = ReallyFlags> + Send422 fn flags_result( 423 &mut self, 424 ) -> impl ::core::future::Future<Output = ReallyFlags> + Send; aggregate_arg( &mut self, x: Aggregates, ) -> impl ::core::future::Future<Output = ()> + Send425 fn aggregate_arg( 426 &mut self, 427 x: Aggregates, 428 ) -> impl ::core::future::Future<Output = ()> + Send; aggregate_result( &mut self, ) -> impl ::core::future::Future<Output = Aggregates> + Send429 fn aggregate_result( 430 &mut self, 431 ) -> impl ::core::future::Future<Output = Aggregates> + Send; typedef_inout( &mut self, e: TupleTypedef2, ) -> impl ::core::future::Future<Output = i32> + Send432 fn typedef_inout( 433 &mut self, 434 e: TupleTypedef2, 435 ) -> impl ::core::future::Future<Output = i32> + Send; 436 } 437 impl<_T: Host + ?Sized + Send> Host for &mut _T { tuple_arg( &mut self, x: (char, u32), ) -> impl ::core::future::Future<Output = ()> + Send438 fn tuple_arg( 439 &mut self, 440 x: (char, u32), 441 ) -> impl ::core::future::Future<Output = ()> + Send { 442 async move { Host::tuple_arg(*self, x).await } 443 } tuple_result( &mut self, ) -> impl ::core::future::Future<Output = (char, u32)> + Send444 fn tuple_result( 445 &mut self, 446 ) -> impl ::core::future::Future<Output = (char, u32)> + Send { 447 async move { Host::tuple_result(*self).await } 448 } empty_arg( &mut self, x: Empty, ) -> impl ::core::future::Future<Output = ()> + Send449 fn empty_arg( 450 &mut self, 451 x: Empty, 452 ) -> impl ::core::future::Future<Output = ()> + Send { 453 async move { Host::empty_arg(*self, x).await } 454 } empty_result( &mut self, ) -> impl ::core::future::Future<Output = Empty> + Send455 fn empty_result( 456 &mut self, 457 ) -> impl ::core::future::Future<Output = Empty> + Send { 458 async move { Host::empty_result(*self).await } 459 } scalar_arg( &mut self, x: Scalars, ) -> impl ::core::future::Future<Output = ()> + Send460 fn scalar_arg( 461 &mut self, 462 x: Scalars, 463 ) -> impl ::core::future::Future<Output = ()> + Send { 464 async move { Host::scalar_arg(*self, x).await } 465 } scalar_result( &mut self, ) -> impl ::core::future::Future<Output = Scalars> + Send466 fn scalar_result( 467 &mut self, 468 ) -> impl ::core::future::Future<Output = Scalars> + Send { 469 async move { Host::scalar_result(*self).await } 470 } flags_arg( &mut self, x: ReallyFlags, ) -> impl ::core::future::Future<Output = ()> + Send471 fn flags_arg( 472 &mut self, 473 x: ReallyFlags, 474 ) -> impl ::core::future::Future<Output = ()> + Send { 475 async move { Host::flags_arg(*self, x).await } 476 } flags_result( &mut self, ) -> impl ::core::future::Future<Output = ReallyFlags> + Send477 fn flags_result( 478 &mut self, 479 ) -> impl ::core::future::Future<Output = ReallyFlags> + Send { 480 async move { Host::flags_result(*self).await } 481 } aggregate_arg( &mut self, x: Aggregates, ) -> impl ::core::future::Future<Output = ()> + Send482 fn aggregate_arg( 483 &mut self, 484 x: Aggregates, 485 ) -> impl ::core::future::Future<Output = ()> + Send { 486 async move { Host::aggregate_arg(*self, x).await } 487 } aggregate_result( &mut self, ) -> impl ::core::future::Future<Output = Aggregates> + Send488 fn aggregate_result( 489 &mut self, 490 ) -> impl ::core::future::Future<Output = Aggregates> + Send { 491 async move { Host::aggregate_result(*self).await } 492 } typedef_inout( &mut self, e: TupleTypedef2, ) -> impl ::core::future::Future<Output = i32> + Send493 fn typedef_inout( 494 &mut self, 495 e: TupleTypedef2, 496 ) -> impl ::core::future::Future<Output = i32> + Send { 497 async move { Host::typedef_inout(*self, e).await } 498 } 499 } 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,500 pub fn add_to_linker<T, D>( 501 linker: &mut wasmtime::component::Linker<T>, 502 host_getter: fn(&mut T) -> D::Data<'_>, 503 ) -> wasmtime::Result<()> 504 where 505 D: HostWithStore, 506 for<'a> D::Data<'a>: Host, 507 T: 'static + Send, 508 { 509 let mut inst = linker.instance("foo:foo/records")?; 510 inst.func_wrap_async( 511 "tuple-arg", 512 move | 513 mut caller: wasmtime::StoreContextMut<'_, T>, 514 (arg0,): ((char, u32),)| 515 { 516 wasmtime::component::__internal::Box::new(async move { 517 let host = &mut host_getter(caller.data_mut()); 518 let r = Host::tuple_arg(host, arg0).await; 519 Ok(r) 520 }) 521 }, 522 )?; 523 inst.func_wrap_async( 524 "tuple-result", 525 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 526 wasmtime::component::__internal::Box::new(async move { 527 let host = &mut host_getter(caller.data_mut()); 528 let r = Host::tuple_result(host).await; 529 Ok((r,)) 530 }) 531 }, 532 )?; 533 inst.func_wrap_async( 534 "empty-arg", 535 move | 536 mut caller: wasmtime::StoreContextMut<'_, T>, 537 (arg0,): (Empty,)| 538 { 539 wasmtime::component::__internal::Box::new(async move { 540 let host = &mut host_getter(caller.data_mut()); 541 let r = Host::empty_arg(host, arg0).await; 542 Ok(r) 543 }) 544 }, 545 )?; 546 inst.func_wrap_async( 547 "empty-result", 548 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 549 wasmtime::component::__internal::Box::new(async move { 550 let host = &mut host_getter(caller.data_mut()); 551 let r = Host::empty_result(host).await; 552 Ok((r,)) 553 }) 554 }, 555 )?; 556 inst.func_wrap_async( 557 "scalar-arg", 558 move | 559 mut caller: wasmtime::StoreContextMut<'_, T>, 560 (arg0,): (Scalars,)| 561 { 562 wasmtime::component::__internal::Box::new(async move { 563 let host = &mut host_getter(caller.data_mut()); 564 let r = Host::scalar_arg(host, arg0).await; 565 Ok(r) 566 }) 567 }, 568 )?; 569 inst.func_wrap_async( 570 "scalar-result", 571 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 572 wasmtime::component::__internal::Box::new(async move { 573 let host = &mut host_getter(caller.data_mut()); 574 let r = Host::scalar_result(host).await; 575 Ok((r,)) 576 }) 577 }, 578 )?; 579 inst.func_wrap_async( 580 "flags-arg", 581 move | 582 mut caller: wasmtime::StoreContextMut<'_, T>, 583 (arg0,): (ReallyFlags,)| 584 { 585 wasmtime::component::__internal::Box::new(async move { 586 let host = &mut host_getter(caller.data_mut()); 587 let r = Host::flags_arg(host, arg0).await; 588 Ok(r) 589 }) 590 }, 591 )?; 592 inst.func_wrap_async( 593 "flags-result", 594 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 595 wasmtime::component::__internal::Box::new(async move { 596 let host = &mut host_getter(caller.data_mut()); 597 let r = Host::flags_result(host).await; 598 Ok((r,)) 599 }) 600 }, 601 )?; 602 inst.func_wrap_async( 603 "aggregate-arg", 604 move | 605 mut caller: wasmtime::StoreContextMut<'_, T>, 606 (arg0,): (Aggregates,)| 607 { 608 wasmtime::component::__internal::Box::new(async move { 609 let host = &mut host_getter(caller.data_mut()); 610 let r = Host::aggregate_arg(host, arg0).await; 611 Ok(r) 612 }) 613 }, 614 )?; 615 inst.func_wrap_async( 616 "aggregate-result", 617 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 618 wasmtime::component::__internal::Box::new(async move { 619 let host = &mut host_getter(caller.data_mut()); 620 let r = Host::aggregate_result(host).await; 621 Ok((r,)) 622 }) 623 }, 624 )?; 625 inst.func_wrap_async( 626 "typedef-inout", 627 move | 628 mut caller: wasmtime::StoreContextMut<'_, T>, 629 (arg0,): (TupleTypedef2,)| 630 { 631 wasmtime::component::__internal::Box::new(async move { 632 let host = &mut host_getter(caller.data_mut()); 633 let r = Host::typedef_inout(host, arg0).await; 634 Ok((r,)) 635 }) 636 }, 637 )?; 638 Ok(()) 639 } 640 } 641 } 642 } 643 pub mod exports { 644 pub mod foo { 645 pub mod foo { 646 #[allow(clippy::all)] 647 pub mod records { 648 #[allow(unused_imports)] 649 use wasmtime::component::__internal::Box; 650 #[derive(wasmtime::component::ComponentType)] 651 #[derive(wasmtime::component::Lift)] 652 #[derive(wasmtime::component::Lower)] 653 #[component(record)] 654 #[derive(Clone, Copy)] 655 pub struct Empty {} 656 impl core::fmt::Debug for Empty { fmt( &self, f: &mut core::fmt::Formatter<'_>, ) -> core::fmt::Result657 fn fmt( 658 &self, 659 f: &mut core::fmt::Formatter<'_>, 660 ) -> core::fmt::Result { 661 f.debug_struct("Empty").finish() 662 } 663 } 664 const _: () = { 665 assert!( 666 0 == < Empty as wasmtime::component::ComponentType >::SIZE32 667 ); 668 assert!( 669 1 == < Empty as wasmtime::component::ComponentType >::ALIGN32 670 ); 671 }; 672 /// A record containing two scalar fields 673 /// that both have the same type 674 #[derive(wasmtime::component::ComponentType)] 675 #[derive(wasmtime::component::Lift)] 676 #[derive(wasmtime::component::Lower)] 677 #[component(record)] 678 #[derive(Clone, Copy)] 679 pub struct Scalars { 680 /// The first field, named a 681 #[component(name = "a")] 682 pub a: u32, 683 /// The second field, named b 684 #[component(name = "b")] 685 pub b: u32, 686 } 687 impl core::fmt::Debug for Scalars { fmt( &self, f: &mut core::fmt::Formatter<'_>, ) -> core::fmt::Result688 fn fmt( 689 &self, 690 f: &mut core::fmt::Formatter<'_>, 691 ) -> core::fmt::Result { 692 f.debug_struct("Scalars") 693 .field("a", &self.a) 694 .field("b", &self.b) 695 .finish() 696 } 697 } 698 const _: () = { 699 assert!( 700 8 == < Scalars as wasmtime::component::ComponentType >::SIZE32 701 ); 702 assert!( 703 4 == < Scalars as wasmtime::component::ComponentType >::ALIGN32 704 ); 705 }; 706 /// A record that is really just flags 707 /// All of the fields are bool 708 #[derive(wasmtime::component::ComponentType)] 709 #[derive(wasmtime::component::Lift)] 710 #[derive(wasmtime::component::Lower)] 711 #[component(record)] 712 #[derive(Clone, Copy)] 713 pub struct ReallyFlags { 714 #[component(name = "a")] 715 pub a: bool, 716 #[component(name = "b")] 717 pub b: bool, 718 #[component(name = "c")] 719 pub c: bool, 720 #[component(name = "d")] 721 pub d: bool, 722 #[component(name = "e")] 723 pub e: bool, 724 #[component(name = "f")] 725 pub f: bool, 726 #[component(name = "g")] 727 pub g: bool, 728 #[component(name = "h")] 729 pub h: bool, 730 #[component(name = "i")] 731 pub i: bool, 732 } 733 impl core::fmt::Debug for ReallyFlags { fmt( &self, f: &mut core::fmt::Formatter<'_>, ) -> core::fmt::Result734 fn fmt( 735 &self, 736 f: &mut core::fmt::Formatter<'_>, 737 ) -> core::fmt::Result { 738 f.debug_struct("ReallyFlags") 739 .field("a", &self.a) 740 .field("b", &self.b) 741 .field("c", &self.c) 742 .field("d", &self.d) 743 .field("e", &self.e) 744 .field("f", &self.f) 745 .field("g", &self.g) 746 .field("h", &self.h) 747 .field("i", &self.i) 748 .finish() 749 } 750 } 751 const _: () = { 752 assert!( 753 9 == < ReallyFlags as wasmtime::component::ComponentType 754 >::SIZE32 755 ); 756 assert!( 757 1 == < ReallyFlags as wasmtime::component::ComponentType 758 >::ALIGN32 759 ); 760 }; 761 #[derive(wasmtime::component::ComponentType)] 762 #[derive(wasmtime::component::Lift)] 763 #[derive(wasmtime::component::Lower)] 764 #[component(record)] 765 #[derive(Clone)] 766 pub struct Aggregates { 767 #[component(name = "a")] 768 pub a: Scalars, 769 #[component(name = "b")] 770 pub b: u32, 771 #[component(name = "c")] 772 pub c: Empty, 773 #[component(name = "d")] 774 pub d: wasmtime::component::__internal::String, 775 #[component(name = "e")] 776 pub e: ReallyFlags, 777 } 778 impl core::fmt::Debug for Aggregates { fmt( &self, f: &mut core::fmt::Formatter<'_>, ) -> core::fmt::Result779 fn fmt( 780 &self, 781 f: &mut core::fmt::Formatter<'_>, 782 ) -> core::fmt::Result { 783 f.debug_struct("Aggregates") 784 .field("a", &self.a) 785 .field("b", &self.b) 786 .field("c", &self.c) 787 .field("d", &self.d) 788 .field("e", &self.e) 789 .finish() 790 } 791 } 792 const _: () = { 793 assert!( 794 32 == < Aggregates as wasmtime::component::ComponentType 795 >::SIZE32 796 ); 797 assert!( 798 4 == < Aggregates as wasmtime::component::ComponentType 799 >::ALIGN32 800 ); 801 }; 802 pub type TupleTypedef = (i32,); 803 const _: () = { 804 assert!( 805 4 == < TupleTypedef as wasmtime::component::ComponentType 806 >::SIZE32 807 ); 808 assert!( 809 4 == < TupleTypedef as wasmtime::component::ComponentType 810 >::ALIGN32 811 ); 812 }; 813 pub type IntTypedef = i32; 814 const _: () = { 815 assert!( 816 4 == < IntTypedef as wasmtime::component::ComponentType >::SIZE32 817 ); 818 assert!( 819 4 == < IntTypedef as wasmtime::component::ComponentType 820 >::ALIGN32 821 ); 822 }; 823 pub type TupleTypedef2 = (IntTypedef,); 824 const _: () = { 825 assert!( 826 4 == < TupleTypedef2 as wasmtime::component::ComponentType 827 >::SIZE32 828 ); 829 assert!( 830 4 == < TupleTypedef2 as wasmtime::component::ComponentType 831 >::ALIGN32 832 ); 833 }; 834 #[derive(wasmtime::component::ComponentType)] 835 #[derive(wasmtime::component::Lift)] 836 #[derive(wasmtime::component::Lower)] 837 #[component(record)] 838 pub struct FuturesAndStreams { 839 #[component(name = "a")] 840 pub a: wasmtime::component::FutureReader<u8>, 841 #[component(name = "b")] 842 pub b: wasmtime::component::StreamReader<u8>, 843 #[component(name = "c")] 844 pub c: wasmtime::component::StreamReader< 845 wasmtime::component::FutureReader< 846 wasmtime::component::StreamReader<()>, 847 >, 848 >, 849 #[component(name = "d")] 850 pub d: wasmtime::component::FutureReader< 851 wasmtime::component::StreamReader< 852 wasmtime::component::FutureReader<()>, 853 >, 854 >, 855 } 856 impl core::fmt::Debug for FuturesAndStreams { fmt( &self, f: &mut core::fmt::Formatter<'_>, ) -> core::fmt::Result857 fn fmt( 858 &self, 859 f: &mut core::fmt::Formatter<'_>, 860 ) -> core::fmt::Result { 861 f.debug_struct("FuturesAndStreams") 862 .field("a", &self.a) 863 .field("b", &self.b) 864 .field("c", &self.c) 865 .field("d", &self.d) 866 .finish() 867 } 868 } 869 const _: () = { 870 assert!( 871 16 == < FuturesAndStreams as wasmtime::component::ComponentType 872 >::SIZE32 873 ); 874 assert!( 875 4 == < FuturesAndStreams as wasmtime::component::ComponentType 876 >::ALIGN32 877 ); 878 }; 879 #[derive(Clone)] 880 pub struct Guest { 881 tuple_arg: wasmtime::component::Func, 882 tuple_result: wasmtime::component::Func, 883 empty_arg: wasmtime::component::Func, 884 empty_result: wasmtime::component::Func, 885 scalar_arg: wasmtime::component::Func, 886 scalar_result: wasmtime::component::Func, 887 flags_arg: wasmtime::component::Func, 888 flags_result: wasmtime::component::Func, 889 aggregate_arg: wasmtime::component::Func, 890 aggregate_result: wasmtime::component::Func, 891 typedef_inout: wasmtime::component::Func, 892 } 893 #[derive(Clone)] 894 pub struct GuestIndices { 895 tuple_arg: wasmtime::component::ComponentExportIndex, 896 tuple_result: wasmtime::component::ComponentExportIndex, 897 empty_arg: wasmtime::component::ComponentExportIndex, 898 empty_result: wasmtime::component::ComponentExportIndex, 899 scalar_arg: wasmtime::component::ComponentExportIndex, 900 scalar_result: wasmtime::component::ComponentExportIndex, 901 flags_arg: wasmtime::component::ComponentExportIndex, 902 flags_result: wasmtime::component::ComponentExportIndex, 903 aggregate_arg: wasmtime::component::ComponentExportIndex, 904 aggregate_result: wasmtime::component::ComponentExportIndex, 905 typedef_inout: wasmtime::component::ComponentExportIndex, 906 } 907 impl GuestIndices { 908 /// Constructor for [`GuestIndices`] which takes a 909 /// [`Component`](wasmtime::component::Component) as input and can be executed 910 /// before instantiation. 911 /// 912 /// This constructor can be used to front-load string lookups to find exports 913 /// within a component. new<_T>( _instance_pre: &wasmtime::component::InstancePre<_T>, ) -> wasmtime::Result<GuestIndices>914 pub fn new<_T>( 915 _instance_pre: &wasmtime::component::InstancePre<_T>, 916 ) -> wasmtime::Result<GuestIndices> { 917 let instance = _instance_pre 918 .component() 919 .get_export_index(None, "foo:foo/records") 920 .ok_or_else(|| { 921 wasmtime::format_err!( 922 "no exported instance named `foo:foo/records`" 923 ) 924 })?; 925 let mut lookup = move |name| { 926 _instance_pre 927 .component() 928 .get_export_index(Some(&instance), name) 929 .ok_or_else(|| { 930 wasmtime::format_err!( 931 "instance export `foo:foo/records` does \ 932 not have export `{name}`" 933 ) 934 }) 935 }; 936 let _ = &mut lookup; 937 let tuple_arg = lookup("tuple-arg")?; 938 let tuple_result = lookup("tuple-result")?; 939 let empty_arg = lookup("empty-arg")?; 940 let empty_result = lookup("empty-result")?; 941 let scalar_arg = lookup("scalar-arg")?; 942 let scalar_result = lookup("scalar-result")?; 943 let flags_arg = lookup("flags-arg")?; 944 let flags_result = lookup("flags-result")?; 945 let aggregate_arg = lookup("aggregate-arg")?; 946 let aggregate_result = lookup("aggregate-result")?; 947 let typedef_inout = lookup("typedef-inout")?; 948 Ok(GuestIndices { 949 tuple_arg, 950 tuple_result, 951 empty_arg, 952 empty_result, 953 scalar_arg, 954 scalar_result, 955 flags_arg, 956 flags_result, 957 aggregate_arg, 958 aggregate_result, 959 typedef_inout, 960 }) 961 } load( &self, mut store: impl wasmtime::AsContextMut, instance: &wasmtime::component::Instance, ) -> wasmtime::Result<Guest>962 pub fn load( 963 &self, 964 mut store: impl wasmtime::AsContextMut, 965 instance: &wasmtime::component::Instance, 966 ) -> wasmtime::Result<Guest> { 967 let _instance = instance; 968 let _instance_pre = _instance.instance_pre(&store); 969 let _instance_type = _instance_pre.instance_type(); 970 let mut store = store.as_context_mut(); 971 let _ = &mut store; 972 let tuple_arg = *_instance 973 .get_typed_func::< 974 ((char, u32),), 975 (), 976 >(&mut store, &self.tuple_arg)? 977 .func(); 978 let tuple_result = *_instance 979 .get_typed_func::< 980 (), 981 ((char, u32),), 982 >(&mut store, &self.tuple_result)? 983 .func(); 984 let empty_arg = *_instance 985 .get_typed_func::<(Empty,), ()>(&mut store, &self.empty_arg)? 986 .func(); 987 let empty_result = *_instance 988 .get_typed_func::< 989 (), 990 (Empty,), 991 >(&mut store, &self.empty_result)? 992 .func(); 993 let scalar_arg = *_instance 994 .get_typed_func::< 995 (Scalars,), 996 (), 997 >(&mut store, &self.scalar_arg)? 998 .func(); 999 let scalar_result = *_instance 1000 .get_typed_func::< 1001 (), 1002 (Scalars,), 1003 >(&mut store, &self.scalar_result)? 1004 .func(); 1005 let flags_arg = *_instance 1006 .get_typed_func::< 1007 (ReallyFlags,), 1008 (), 1009 >(&mut store, &self.flags_arg)? 1010 .func(); 1011 let flags_result = *_instance 1012 .get_typed_func::< 1013 (), 1014 (ReallyFlags,), 1015 >(&mut store, &self.flags_result)? 1016 .func(); 1017 let aggregate_arg = *_instance 1018 .get_typed_func::< 1019 (&Aggregates,), 1020 (), 1021 >(&mut store, &self.aggregate_arg)? 1022 .func(); 1023 let aggregate_result = *_instance 1024 .get_typed_func::< 1025 (), 1026 (Aggregates,), 1027 >(&mut store, &self.aggregate_result)? 1028 .func(); 1029 let typedef_inout = *_instance 1030 .get_typed_func::< 1031 (TupleTypedef2,), 1032 (i32,), 1033 >(&mut store, &self.typedef_inout)? 1034 .func(); 1035 Ok(Guest { 1036 tuple_arg, 1037 tuple_result, 1038 empty_arg, 1039 empty_result, 1040 scalar_arg, 1041 scalar_result, 1042 flags_arg, 1043 flags_result, 1044 aggregate_arg, 1045 aggregate_result, 1046 typedef_inout, 1047 }) 1048 } 1049 } 1050 impl Guest { call_tuple_arg<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: (char, u32), ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,1051 pub async fn call_tuple_arg<S: wasmtime::AsContextMut>( 1052 &self, 1053 mut store: S, 1054 arg0: (char, u32), 1055 ) -> wasmtime::Result<()> 1056 where 1057 <S as wasmtime::AsContext>::Data: Send, 1058 { 1059 let callee = unsafe { 1060 wasmtime::component::TypedFunc::< 1061 ((char, u32),), 1062 (), 1063 >::new_unchecked(self.tuple_arg) 1064 }; 1065 let () = callee 1066 .call_async(store.as_context_mut(), (arg0,)) 1067 .await?; 1068 Ok(()) 1069 } call_tuple_result<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<(char, u32)> where <S as wasmtime::AsContext>::Data: Send,1070 pub async fn call_tuple_result<S: wasmtime::AsContextMut>( 1071 &self, 1072 mut store: S, 1073 ) -> wasmtime::Result<(char, u32)> 1074 where 1075 <S as wasmtime::AsContext>::Data: Send, 1076 { 1077 let callee = unsafe { 1078 wasmtime::component::TypedFunc::< 1079 (), 1080 ((char, u32),), 1081 >::new_unchecked(self.tuple_result) 1082 }; 1083 let (ret0,) = callee 1084 .call_async(store.as_context_mut(), ()) 1085 .await?; 1086 Ok(ret0) 1087 } call_empty_arg<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: Empty, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,1088 pub async fn call_empty_arg<S: wasmtime::AsContextMut>( 1089 &self, 1090 mut store: S, 1091 arg0: Empty, 1092 ) -> wasmtime::Result<()> 1093 where 1094 <S as wasmtime::AsContext>::Data: Send, 1095 { 1096 let callee = unsafe { 1097 wasmtime::component::TypedFunc::< 1098 (Empty,), 1099 (), 1100 >::new_unchecked(self.empty_arg) 1101 }; 1102 let () = callee 1103 .call_async(store.as_context_mut(), (arg0,)) 1104 .await?; 1105 Ok(()) 1106 } call_empty_result<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<Empty> where <S as wasmtime::AsContext>::Data: Send,1107 pub async fn call_empty_result<S: wasmtime::AsContextMut>( 1108 &self, 1109 mut store: S, 1110 ) -> wasmtime::Result<Empty> 1111 where 1112 <S as wasmtime::AsContext>::Data: Send, 1113 { 1114 let callee = unsafe { 1115 wasmtime::component::TypedFunc::< 1116 (), 1117 (Empty,), 1118 >::new_unchecked(self.empty_result) 1119 }; 1120 let (ret0,) = callee 1121 .call_async(store.as_context_mut(), ()) 1122 .await?; 1123 Ok(ret0) 1124 } call_scalar_arg<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: Scalars, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,1125 pub async fn call_scalar_arg<S: wasmtime::AsContextMut>( 1126 &self, 1127 mut store: S, 1128 arg0: Scalars, 1129 ) -> wasmtime::Result<()> 1130 where 1131 <S as wasmtime::AsContext>::Data: Send, 1132 { 1133 let callee = unsafe { 1134 wasmtime::component::TypedFunc::< 1135 (Scalars,), 1136 (), 1137 >::new_unchecked(self.scalar_arg) 1138 }; 1139 let () = callee 1140 .call_async(store.as_context_mut(), (arg0,)) 1141 .await?; 1142 Ok(()) 1143 } call_scalar_result<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<Scalars> where <S as wasmtime::AsContext>::Data: Send,1144 pub async fn call_scalar_result<S: wasmtime::AsContextMut>( 1145 &self, 1146 mut store: S, 1147 ) -> wasmtime::Result<Scalars> 1148 where 1149 <S as wasmtime::AsContext>::Data: Send, 1150 { 1151 let callee = unsafe { 1152 wasmtime::component::TypedFunc::< 1153 (), 1154 (Scalars,), 1155 >::new_unchecked(self.scalar_result) 1156 }; 1157 let (ret0,) = callee 1158 .call_async(store.as_context_mut(), ()) 1159 .await?; 1160 Ok(ret0) 1161 } call_flags_arg<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: ReallyFlags, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,1162 pub async fn call_flags_arg<S: wasmtime::AsContextMut>( 1163 &self, 1164 mut store: S, 1165 arg0: ReallyFlags, 1166 ) -> wasmtime::Result<()> 1167 where 1168 <S as wasmtime::AsContext>::Data: Send, 1169 { 1170 let callee = unsafe { 1171 wasmtime::component::TypedFunc::< 1172 (ReallyFlags,), 1173 (), 1174 >::new_unchecked(self.flags_arg) 1175 }; 1176 let () = callee 1177 .call_async(store.as_context_mut(), (arg0,)) 1178 .await?; 1179 Ok(()) 1180 } call_flags_result<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<ReallyFlags> where <S as wasmtime::AsContext>::Data: Send,1181 pub async fn call_flags_result<S: wasmtime::AsContextMut>( 1182 &self, 1183 mut store: S, 1184 ) -> wasmtime::Result<ReallyFlags> 1185 where 1186 <S as wasmtime::AsContext>::Data: Send, 1187 { 1188 let callee = unsafe { 1189 wasmtime::component::TypedFunc::< 1190 (), 1191 (ReallyFlags,), 1192 >::new_unchecked(self.flags_result) 1193 }; 1194 let (ret0,) = callee 1195 .call_async(store.as_context_mut(), ()) 1196 .await?; 1197 Ok(ret0) 1198 } call_aggregate_arg<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: &Aggregates, ) -> wasmtime::Result<()> where <S as wasmtime::AsContext>::Data: Send,1199 pub async fn call_aggregate_arg<S: wasmtime::AsContextMut>( 1200 &self, 1201 mut store: S, 1202 arg0: &Aggregates, 1203 ) -> wasmtime::Result<()> 1204 where 1205 <S as wasmtime::AsContext>::Data: Send, 1206 { 1207 let callee = unsafe { 1208 wasmtime::component::TypedFunc::< 1209 (&Aggregates,), 1210 (), 1211 >::new_unchecked(self.aggregate_arg) 1212 }; 1213 let () = callee 1214 .call_async(store.as_context_mut(), (arg0,)) 1215 .await?; 1216 Ok(()) 1217 } call_aggregate_result<S: wasmtime::AsContextMut>( &self, mut store: S, ) -> wasmtime::Result<Aggregates> where <S as wasmtime::AsContext>::Data: Send,1218 pub async fn call_aggregate_result<S: wasmtime::AsContextMut>( 1219 &self, 1220 mut store: S, 1221 ) -> wasmtime::Result<Aggregates> 1222 where 1223 <S as wasmtime::AsContext>::Data: Send, 1224 { 1225 let callee = unsafe { 1226 wasmtime::component::TypedFunc::< 1227 (), 1228 (Aggregates,), 1229 >::new_unchecked(self.aggregate_result) 1230 }; 1231 let (ret0,) = callee 1232 .call_async(store.as_context_mut(), ()) 1233 .await?; 1234 Ok(ret0) 1235 } call_typedef_inout<S: wasmtime::AsContextMut>( &self, mut store: S, arg0: TupleTypedef2, ) -> wasmtime::Result<i32> where <S as wasmtime::AsContext>::Data: Send,1236 pub async fn call_typedef_inout<S: wasmtime::AsContextMut>( 1237 &self, 1238 mut store: S, 1239 arg0: TupleTypedef2, 1240 ) -> wasmtime::Result<i32> 1241 where 1242 <S as wasmtime::AsContext>::Data: Send, 1243 { 1244 let callee = unsafe { 1245 wasmtime::component::TypedFunc::< 1246 (TupleTypedef2,), 1247 (i32,), 1248 >::new_unchecked(self.typedef_inout) 1249 }; 1250 let (ret0,) = callee 1251 .call_async(store.as_context_mut(), (arg0,)) 1252 .await?; 1253 Ok(ret0) 1254 } 1255 } 1256 } 1257 } 1258 } 1259 } 1260