1 /// Auto-generated bindings for a pre-instantiated version of a 2 /// component which implements the world `the-lists`. 3 /// 4 /// This structure is created through [`TheListsPre::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 [`TheLists`] as well. 9 pub struct TheListsPre<T: 'static> { 10 instance_pre: wasmtime::component::InstancePre<T>, 11 indices: TheListsIndices, 12 } 13 impl<T: 'static> Clone for TheListsPre<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> TheListsPre<_T> { 22 /// Creates a new copy of `TheListsPre` 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 = TheListsIndices::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 [`TheLists`] 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<TheLists> { 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> TheListsPre<_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<TheLists> { 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-lists`. 68 /// 69 /// This is an implementation detail of [`TheListsPre`] and can 70 /// be constructed if needed as well. 71 /// 72 /// For more information see [`TheLists`] as well. 73 #[derive(Clone)] 74 pub struct TheListsIndices { 75 interface0: exports::foo::foo::lists::GuestIndices, 76 } 77 /// Auto-generated bindings for an instance a component which 78 /// implements the world `the-lists`. 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 /// [`TheLists::instantiate`] which only needs a 85 /// [`Store`], [`Component`], and [`Linker`]. 86 /// 87 /// * Alternatively you can create a [`TheListsPre`] 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 [`TheListsPre::instantiate`] to 91 /// create a [`TheLists`]. 92 /// 93 /// * If you've instantiated the instance yourself already 94 /// then you can use [`TheLists::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 TheLists { 103 interface0: exports::foo::foo::lists::Guest, 104 } 105 const _: () = { 106 impl TheListsIndices { 107 /// Creates a new copy of `TheListsIndices` bindings which can then 108 /// be used to instantiate into a particular store. 109 /// 110 /// This method may fail if the component does not have the 111 /// required exports. 112 pub fn new<_T>( 113 _instance_pre: &wasmtime::component::InstancePre<_T>, 114 ) -> wasmtime::Result<Self> { 115 let _component = _instance_pre.component(); 116 let _instance_type = _instance_pre.instance_type(); 117 let interface0 = exports::foo::foo::lists::GuestIndices::new(_instance_pre)?; 118 Ok(TheListsIndices { interface0 }) 119 } 120 /// Uses the indices stored in `self` to load an instance 121 /// of [`TheLists`] from the instance provided. 122 /// 123 /// Note that at this time this method will additionally 124 /// perform type-checks of all exports. 125 pub fn load( 126 &self, 127 mut store: impl wasmtime::AsContextMut, 128 instance: &wasmtime::component::Instance, 129 ) -> wasmtime::Result<TheLists> { 130 let _ = &mut store; 131 let _instance = instance; 132 let interface0 = self.interface0.load(&mut store, &_instance)?; 133 Ok(TheLists { interface0 }) 134 } 135 } 136 impl TheLists { 137 /// Convenience wrapper around [`TheListsPre::new`] and 138 /// [`TheListsPre::instantiate`]. 139 pub fn instantiate<_T>( 140 store: impl wasmtime::AsContextMut<Data = _T>, 141 component: &wasmtime::component::Component, 142 linker: &wasmtime::component::Linker<_T>, 143 ) -> wasmtime::Result<TheLists> { 144 let pre = linker.instantiate_pre(component)?; 145 TheListsPre::new(pre)?.instantiate(store) 146 } 147 /// Convenience wrapper around [`TheListsIndices::new`] and 148 /// [`TheListsIndices::load`]. 149 pub fn new( 150 mut store: impl wasmtime::AsContextMut, 151 instance: &wasmtime::component::Instance, 152 ) -> wasmtime::Result<TheLists> { 153 let indices = TheListsIndices::new(&instance.instance_pre(&store))?; 154 indices.load(&mut store, instance) 155 } 156 /// Convenience wrapper around [`TheListsPre::new`] and 157 /// [`TheListsPre::instantiate_async`]. 158 pub async fn instantiate_async<_T>( 159 store: impl wasmtime::AsContextMut<Data = _T>, 160 component: &wasmtime::component::Component, 161 linker: &wasmtime::component::Linker<_T>, 162 ) -> wasmtime::Result<TheLists> 163 where 164 _T: Send, 165 { 166 let pre = linker.instantiate_pre(component)?; 167 TheListsPre::new(pre)?.instantiate_async(store).await 168 } 169 pub fn add_to_linker<T, D>( 170 linker: &mut wasmtime::component::Linker<T>, 171 host_getter: fn(&mut T) -> D::Data<'_>, 172 ) -> wasmtime::Result<()> 173 where 174 D: foo::foo::lists::HostWithStore + Send, 175 for<'a> D::Data<'a>: foo::foo::lists::Host + Send, 176 T: 'static + Send, 177 { 178 foo::foo::lists::add_to_linker::<T, D>(linker, host_getter)?; 179 Ok(()) 180 } 181 pub fn foo_foo_lists(&self) -> &exports::foo::foo::lists::Guest { 182 &self.interface0 183 } 184 } 185 }; 186 pub mod foo { 187 pub mod foo { 188 #[allow(clippy::all)] 189 pub mod lists { 190 #[allow(unused_imports)] 191 use wasmtime::component::__internal::Box; 192 #[derive(wasmtime::component::ComponentType)] 193 #[derive(wasmtime::component::Lift)] 194 #[derive(wasmtime::component::Lower)] 195 #[component(record)] 196 #[derive(Clone)] 197 pub struct OtherRecord { 198 #[component(name = "a1")] 199 pub a1: u32, 200 #[component(name = "a2")] 201 pub a2: u64, 202 #[component(name = "a3")] 203 pub a3: i32, 204 #[component(name = "a4")] 205 pub a4: i64, 206 #[component(name = "b")] 207 pub b: wasmtime::component::__internal::String, 208 #[component(name = "c")] 209 pub c: wasmtime::component::__internal::Vec<u8>, 210 } 211 impl core::fmt::Debug for OtherRecord { 212 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 213 f.debug_struct("OtherRecord") 214 .field("a1", &self.a1) 215 .field("a2", &self.a2) 216 .field("a3", &self.a3) 217 .field("a4", &self.a4) 218 .field("b", &self.b) 219 .field("c", &self.c) 220 .finish() 221 } 222 } 223 const _: () = { 224 assert!( 225 48 == < OtherRecord as wasmtime::component::ComponentType >::SIZE32 226 ); 227 assert!( 228 8 == < OtherRecord as wasmtime::component::ComponentType >::ALIGN32 229 ); 230 }; 231 #[derive(wasmtime::component::ComponentType)] 232 #[derive(wasmtime::component::Lift)] 233 #[derive(wasmtime::component::Lower)] 234 #[component(record)] 235 #[derive(Clone)] 236 pub struct SomeRecord { 237 #[component(name = "x")] 238 pub x: wasmtime::component::__internal::String, 239 #[component(name = "y")] 240 pub y: OtherRecord, 241 #[component(name = "z")] 242 pub z: wasmtime::component::__internal::Vec<OtherRecord>, 243 #[component(name = "c1")] 244 pub c1: u32, 245 #[component(name = "c2")] 246 pub c2: u64, 247 #[component(name = "c3")] 248 pub c3: i32, 249 #[component(name = "c4")] 250 pub c4: i64, 251 } 252 impl core::fmt::Debug for SomeRecord { 253 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 254 f.debug_struct("SomeRecord") 255 .field("x", &self.x) 256 .field("y", &self.y) 257 .field("z", &self.z) 258 .field("c1", &self.c1) 259 .field("c2", &self.c2) 260 .field("c3", &self.c3) 261 .field("c4", &self.c4) 262 .finish() 263 } 264 } 265 const _: () = { 266 assert!( 267 96 == < SomeRecord as wasmtime::component::ComponentType >::SIZE32 268 ); 269 assert!( 270 8 == < SomeRecord as wasmtime::component::ComponentType >::ALIGN32 271 ); 272 }; 273 #[derive(wasmtime::component::ComponentType)] 274 #[derive(wasmtime::component::Lift)] 275 #[derive(wasmtime::component::Lower)] 276 #[component(variant)] 277 #[derive(Clone)] 278 pub enum OtherVariant { 279 #[component(name = "a")] 280 A, 281 #[component(name = "b")] 282 B(u32), 283 #[component(name = "c")] 284 C(wasmtime::component::__internal::String), 285 } 286 impl core::fmt::Debug for OtherVariant { 287 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 288 match self { 289 OtherVariant::A => f.debug_tuple("OtherVariant::A").finish(), 290 OtherVariant::B(e) => { 291 f.debug_tuple("OtherVariant::B").field(e).finish() 292 } 293 OtherVariant::C(e) => { 294 f.debug_tuple("OtherVariant::C").field(e).finish() 295 } 296 } 297 } 298 } 299 const _: () = { 300 assert!( 301 12 == < OtherVariant as wasmtime::component::ComponentType >::SIZE32 302 ); 303 assert!( 304 4 == < OtherVariant as wasmtime::component::ComponentType >::ALIGN32 305 ); 306 }; 307 #[derive(wasmtime::component::ComponentType)] 308 #[derive(wasmtime::component::Lift)] 309 #[derive(wasmtime::component::Lower)] 310 #[component(variant)] 311 #[derive(Clone)] 312 pub enum SomeVariant { 313 #[component(name = "a")] 314 A(wasmtime::component::__internal::String), 315 #[component(name = "b")] 316 B, 317 #[component(name = "c")] 318 C(u32), 319 #[component(name = "d")] 320 D(wasmtime::component::__internal::Vec<OtherVariant>), 321 } 322 impl core::fmt::Debug for SomeVariant { 323 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 324 match self { 325 SomeVariant::A(e) => { 326 f.debug_tuple("SomeVariant::A").field(e).finish() 327 } 328 SomeVariant::B => f.debug_tuple("SomeVariant::B").finish(), 329 SomeVariant::C(e) => { 330 f.debug_tuple("SomeVariant::C").field(e).finish() 331 } 332 SomeVariant::D(e) => { 333 f.debug_tuple("SomeVariant::D").field(e).finish() 334 } 335 } 336 } 337 } 338 const _: () = { 339 assert!( 340 12 == < SomeVariant as wasmtime::component::ComponentType >::SIZE32 341 ); 342 assert!( 343 4 == < SomeVariant as wasmtime::component::ComponentType >::ALIGN32 344 ); 345 }; 346 pub type LoadStoreAllSizes = wasmtime::component::__internal::Vec< 347 ( 348 wasmtime::component::__internal::String, 349 u8, 350 i8, 351 u16, 352 i16, 353 u32, 354 i32, 355 u64, 356 i64, 357 f32, 358 f64, 359 char, 360 ), 361 >; 362 const _: () = { 363 assert!( 364 8 == < LoadStoreAllSizes as wasmtime::component::ComponentType 365 >::SIZE32 366 ); 367 assert!( 368 4 == < LoadStoreAllSizes as wasmtime::component::ComponentType 369 >::ALIGN32 370 ); 371 }; 372 pub trait HostWithStore: wasmtime::component::HasData + Send {} 373 impl<_T: ?Sized> HostWithStore for _T 374 where 375 _T: wasmtime::component::HasData + Send, 376 {} 377 pub trait Host: Send { 378 fn list_u8_param( 379 &mut self, 380 x: wasmtime::component::__internal::Vec<u8>, 381 ) -> impl ::core::future::Future<Output = ()> + Send; 382 fn list_u16_param( 383 &mut self, 384 x: wasmtime::component::__internal::Vec<u16>, 385 ) -> impl ::core::future::Future<Output = ()> + Send; 386 fn list_u32_param( 387 &mut self, 388 x: wasmtime::component::__internal::Vec<u32>, 389 ) -> impl ::core::future::Future<Output = ()> + Send; 390 fn list_u64_param( 391 &mut self, 392 x: wasmtime::component::__internal::Vec<u64>, 393 ) -> impl ::core::future::Future<Output = ()> + Send; 394 fn list_s8_param( 395 &mut self, 396 x: wasmtime::component::__internal::Vec<i8>, 397 ) -> impl ::core::future::Future<Output = ()> + Send; 398 fn list_s16_param( 399 &mut self, 400 x: wasmtime::component::__internal::Vec<i16>, 401 ) -> impl ::core::future::Future<Output = ()> + Send; 402 fn list_s32_param( 403 &mut self, 404 x: wasmtime::component::__internal::Vec<i32>, 405 ) -> impl ::core::future::Future<Output = ()> + Send; 406 fn list_s64_param( 407 &mut self, 408 x: wasmtime::component::__internal::Vec<i64>, 409 ) -> impl ::core::future::Future<Output = ()> + Send; 410 fn list_f32_param( 411 &mut self, 412 x: wasmtime::component::__internal::Vec<f32>, 413 ) -> impl ::core::future::Future<Output = ()> + Send; 414 fn list_f64_param( 415 &mut self, 416 x: wasmtime::component::__internal::Vec<f64>, 417 ) -> impl ::core::future::Future<Output = ()> + Send; 418 fn list_u8_ret( 419 &mut self, 420 ) -> impl ::core::future::Future< 421 Output = wasmtime::component::__internal::Vec<u8>, 422 > + Send; 423 fn list_u16_ret( 424 &mut self, 425 ) -> impl ::core::future::Future< 426 Output = wasmtime::component::__internal::Vec<u16>, 427 > + Send; 428 fn list_u32_ret( 429 &mut self, 430 ) -> impl ::core::future::Future< 431 Output = wasmtime::component::__internal::Vec<u32>, 432 > + Send; 433 fn list_u64_ret( 434 &mut self, 435 ) -> impl ::core::future::Future< 436 Output = wasmtime::component::__internal::Vec<u64>, 437 > + Send; 438 fn list_s8_ret( 439 &mut self, 440 ) -> impl ::core::future::Future< 441 Output = wasmtime::component::__internal::Vec<i8>, 442 > + Send; 443 fn list_s16_ret( 444 &mut self, 445 ) -> impl ::core::future::Future< 446 Output = wasmtime::component::__internal::Vec<i16>, 447 > + Send; 448 fn list_s32_ret( 449 &mut self, 450 ) -> impl ::core::future::Future< 451 Output = wasmtime::component::__internal::Vec<i32>, 452 > + Send; 453 fn list_s64_ret( 454 &mut self, 455 ) -> impl ::core::future::Future< 456 Output = wasmtime::component::__internal::Vec<i64>, 457 > + Send; 458 fn list_f32_ret( 459 &mut self, 460 ) -> impl ::core::future::Future< 461 Output = wasmtime::component::__internal::Vec<f32>, 462 > + Send; 463 fn list_f64_ret( 464 &mut self, 465 ) -> impl ::core::future::Future< 466 Output = wasmtime::component::__internal::Vec<f64>, 467 > + Send; 468 fn tuple_list( 469 &mut self, 470 x: wasmtime::component::__internal::Vec<(u8, i8)>, 471 ) -> impl ::core::future::Future< 472 Output = wasmtime::component::__internal::Vec<(i64, u32)>, 473 > + Send; 474 fn string_list_arg( 475 &mut self, 476 a: wasmtime::component::__internal::Vec< 477 wasmtime::component::__internal::String, 478 >, 479 ) -> impl ::core::future::Future<Output = ()> + Send; 480 fn string_list_ret( 481 &mut self, 482 ) -> impl ::core::future::Future< 483 Output = wasmtime::component::__internal::Vec< 484 wasmtime::component::__internal::String, 485 >, 486 > + Send; 487 fn tuple_string_list( 488 &mut self, 489 x: wasmtime::component::__internal::Vec< 490 (u8, wasmtime::component::__internal::String), 491 >, 492 ) -> impl ::core::future::Future< 493 Output = wasmtime::component::__internal::Vec< 494 (wasmtime::component::__internal::String, u8), 495 >, 496 > + Send; 497 fn string_list( 498 &mut self, 499 x: wasmtime::component::__internal::Vec< 500 wasmtime::component::__internal::String, 501 >, 502 ) -> impl ::core::future::Future< 503 Output = wasmtime::component::__internal::Vec< 504 wasmtime::component::__internal::String, 505 >, 506 > + Send; 507 fn record_list( 508 &mut self, 509 x: wasmtime::component::__internal::Vec<SomeRecord>, 510 ) -> impl ::core::future::Future< 511 Output = wasmtime::component::__internal::Vec<OtherRecord>, 512 > + Send; 513 fn record_list_reverse( 514 &mut self, 515 x: wasmtime::component::__internal::Vec<OtherRecord>, 516 ) -> impl ::core::future::Future< 517 Output = wasmtime::component::__internal::Vec<SomeRecord>, 518 > + Send; 519 fn variant_list( 520 &mut self, 521 x: wasmtime::component::__internal::Vec<SomeVariant>, 522 ) -> impl ::core::future::Future< 523 Output = wasmtime::component::__internal::Vec<OtherVariant>, 524 > + Send; 525 fn load_store_everything( 526 &mut self, 527 a: LoadStoreAllSizes, 528 ) -> impl ::core::future::Future<Output = LoadStoreAllSizes> + Send; 529 } 530 impl<_T: Host + ?Sized + Send> Host for &mut _T { 531 fn list_u8_param( 532 &mut self, 533 x: wasmtime::component::__internal::Vec<u8>, 534 ) -> impl ::core::future::Future<Output = ()> + Send { 535 async move { Host::list_u8_param(*self, x).await } 536 } 537 fn list_u16_param( 538 &mut self, 539 x: wasmtime::component::__internal::Vec<u16>, 540 ) -> impl ::core::future::Future<Output = ()> + Send { 541 async move { Host::list_u16_param(*self, x).await } 542 } 543 fn list_u32_param( 544 &mut self, 545 x: wasmtime::component::__internal::Vec<u32>, 546 ) -> impl ::core::future::Future<Output = ()> + Send { 547 async move { Host::list_u32_param(*self, x).await } 548 } 549 fn list_u64_param( 550 &mut self, 551 x: wasmtime::component::__internal::Vec<u64>, 552 ) -> impl ::core::future::Future<Output = ()> + Send { 553 async move { Host::list_u64_param(*self, x).await } 554 } 555 fn list_s8_param( 556 &mut self, 557 x: wasmtime::component::__internal::Vec<i8>, 558 ) -> impl ::core::future::Future<Output = ()> + Send { 559 async move { Host::list_s8_param(*self, x).await } 560 } 561 fn list_s16_param( 562 &mut self, 563 x: wasmtime::component::__internal::Vec<i16>, 564 ) -> impl ::core::future::Future<Output = ()> + Send { 565 async move { Host::list_s16_param(*self, x).await } 566 } 567 fn list_s32_param( 568 &mut self, 569 x: wasmtime::component::__internal::Vec<i32>, 570 ) -> impl ::core::future::Future<Output = ()> + Send { 571 async move { Host::list_s32_param(*self, x).await } 572 } 573 fn list_s64_param( 574 &mut self, 575 x: wasmtime::component::__internal::Vec<i64>, 576 ) -> impl ::core::future::Future<Output = ()> + Send { 577 async move { Host::list_s64_param(*self, x).await } 578 } 579 fn list_f32_param( 580 &mut self, 581 x: wasmtime::component::__internal::Vec<f32>, 582 ) -> impl ::core::future::Future<Output = ()> + Send { 583 async move { Host::list_f32_param(*self, x).await } 584 } 585 fn list_f64_param( 586 &mut self, 587 x: wasmtime::component::__internal::Vec<f64>, 588 ) -> impl ::core::future::Future<Output = ()> + Send { 589 async move { Host::list_f64_param(*self, x).await } 590 } 591 fn list_u8_ret( 592 &mut self, 593 ) -> impl ::core::future::Future< 594 Output = wasmtime::component::__internal::Vec<u8>, 595 > + Send { 596 async move { Host::list_u8_ret(*self).await } 597 } 598 fn list_u16_ret( 599 &mut self, 600 ) -> impl ::core::future::Future< 601 Output = wasmtime::component::__internal::Vec<u16>, 602 > + Send { 603 async move { Host::list_u16_ret(*self).await } 604 } 605 fn list_u32_ret( 606 &mut self, 607 ) -> impl ::core::future::Future< 608 Output = wasmtime::component::__internal::Vec<u32>, 609 > + Send { 610 async move { Host::list_u32_ret(*self).await } 611 } 612 fn list_u64_ret( 613 &mut self, 614 ) -> impl ::core::future::Future< 615 Output = wasmtime::component::__internal::Vec<u64>, 616 > + Send { 617 async move { Host::list_u64_ret(*self).await } 618 } 619 fn list_s8_ret( 620 &mut self, 621 ) -> impl ::core::future::Future< 622 Output = wasmtime::component::__internal::Vec<i8>, 623 > + Send { 624 async move { Host::list_s8_ret(*self).await } 625 } 626 fn list_s16_ret( 627 &mut self, 628 ) -> impl ::core::future::Future< 629 Output = wasmtime::component::__internal::Vec<i16>, 630 > + Send { 631 async move { Host::list_s16_ret(*self).await } 632 } 633 fn list_s32_ret( 634 &mut self, 635 ) -> impl ::core::future::Future< 636 Output = wasmtime::component::__internal::Vec<i32>, 637 > + Send { 638 async move { Host::list_s32_ret(*self).await } 639 } 640 fn list_s64_ret( 641 &mut self, 642 ) -> impl ::core::future::Future< 643 Output = wasmtime::component::__internal::Vec<i64>, 644 > + Send { 645 async move { Host::list_s64_ret(*self).await } 646 } 647 fn list_f32_ret( 648 &mut self, 649 ) -> impl ::core::future::Future< 650 Output = wasmtime::component::__internal::Vec<f32>, 651 > + Send { 652 async move { Host::list_f32_ret(*self).await } 653 } 654 fn list_f64_ret( 655 &mut self, 656 ) -> impl ::core::future::Future< 657 Output = wasmtime::component::__internal::Vec<f64>, 658 > + Send { 659 async move { Host::list_f64_ret(*self).await } 660 } 661 fn tuple_list( 662 &mut self, 663 x: wasmtime::component::__internal::Vec<(u8, i8)>, 664 ) -> impl ::core::future::Future< 665 Output = wasmtime::component::__internal::Vec<(i64, u32)>, 666 > + Send { 667 async move { Host::tuple_list(*self, x).await } 668 } 669 fn string_list_arg( 670 &mut self, 671 a: wasmtime::component::__internal::Vec< 672 wasmtime::component::__internal::String, 673 >, 674 ) -> impl ::core::future::Future<Output = ()> + Send { 675 async move { Host::string_list_arg(*self, a).await } 676 } 677 fn string_list_ret( 678 &mut self, 679 ) -> impl ::core::future::Future< 680 Output = wasmtime::component::__internal::Vec< 681 wasmtime::component::__internal::String, 682 >, 683 > + Send { 684 async move { Host::string_list_ret(*self).await } 685 } 686 fn tuple_string_list( 687 &mut self, 688 x: wasmtime::component::__internal::Vec< 689 (u8, wasmtime::component::__internal::String), 690 >, 691 ) -> impl ::core::future::Future< 692 Output = wasmtime::component::__internal::Vec< 693 (wasmtime::component::__internal::String, u8), 694 >, 695 > + Send { 696 async move { Host::tuple_string_list(*self, x).await } 697 } 698 fn string_list( 699 &mut self, 700 x: wasmtime::component::__internal::Vec< 701 wasmtime::component::__internal::String, 702 >, 703 ) -> impl ::core::future::Future< 704 Output = wasmtime::component::__internal::Vec< 705 wasmtime::component::__internal::String, 706 >, 707 > + Send { 708 async move { Host::string_list(*self, x).await } 709 } 710 fn record_list( 711 &mut self, 712 x: wasmtime::component::__internal::Vec<SomeRecord>, 713 ) -> impl ::core::future::Future< 714 Output = wasmtime::component::__internal::Vec<OtherRecord>, 715 > + Send { 716 async move { Host::record_list(*self, x).await } 717 } 718 fn record_list_reverse( 719 &mut self, 720 x: wasmtime::component::__internal::Vec<OtherRecord>, 721 ) -> impl ::core::future::Future< 722 Output = wasmtime::component::__internal::Vec<SomeRecord>, 723 > + Send { 724 async move { Host::record_list_reverse(*self, x).await } 725 } 726 fn variant_list( 727 &mut self, 728 x: wasmtime::component::__internal::Vec<SomeVariant>, 729 ) -> impl ::core::future::Future< 730 Output = wasmtime::component::__internal::Vec<OtherVariant>, 731 > + Send { 732 async move { Host::variant_list(*self, x).await } 733 } 734 fn load_store_everything( 735 &mut self, 736 a: LoadStoreAllSizes, 737 ) -> impl ::core::future::Future<Output = LoadStoreAllSizes> + Send { 738 async move { Host::load_store_everything(*self, a).await } 739 } 740 } 741 pub fn add_to_linker<T, D>( 742 linker: &mut wasmtime::component::Linker<T>, 743 host_getter: fn(&mut T) -> D::Data<'_>, 744 ) -> wasmtime::Result<()> 745 where 746 D: HostWithStore, 747 for<'a> D::Data<'a>: Host, 748 T: 'static + Send, 749 { 750 let mut inst = linker.instance("foo:foo/lists")?; 751 inst.func_wrap_async( 752 "list-u8-param", 753 move | 754 mut caller: wasmtime::StoreContextMut<'_, T>, 755 (arg0,): (wasmtime::component::__internal::Vec<u8>,)| 756 { 757 wasmtime::component::__internal::Box::new(async move { 758 let host = &mut host_getter(caller.data_mut()); 759 let r = Host::list_u8_param(host, arg0).await; 760 Ok(r) 761 }) 762 }, 763 )?; 764 inst.func_wrap_async( 765 "list-u16-param", 766 move | 767 mut caller: wasmtime::StoreContextMut<'_, T>, 768 (arg0,): (wasmtime::component::__internal::Vec<u16>,)| 769 { 770 wasmtime::component::__internal::Box::new(async move { 771 let host = &mut host_getter(caller.data_mut()); 772 let r = Host::list_u16_param(host, arg0).await; 773 Ok(r) 774 }) 775 }, 776 )?; 777 inst.func_wrap_async( 778 "list-u32-param", 779 move | 780 mut caller: wasmtime::StoreContextMut<'_, T>, 781 (arg0,): (wasmtime::component::__internal::Vec<u32>,)| 782 { 783 wasmtime::component::__internal::Box::new(async move { 784 let host = &mut host_getter(caller.data_mut()); 785 let r = Host::list_u32_param(host, arg0).await; 786 Ok(r) 787 }) 788 }, 789 )?; 790 inst.func_wrap_async( 791 "list-u64-param", 792 move | 793 mut caller: wasmtime::StoreContextMut<'_, T>, 794 (arg0,): (wasmtime::component::__internal::Vec<u64>,)| 795 { 796 wasmtime::component::__internal::Box::new(async move { 797 let host = &mut host_getter(caller.data_mut()); 798 let r = Host::list_u64_param(host, arg0).await; 799 Ok(r) 800 }) 801 }, 802 )?; 803 inst.func_wrap_async( 804 "list-s8-param", 805 move | 806 mut caller: wasmtime::StoreContextMut<'_, T>, 807 (arg0,): (wasmtime::component::__internal::Vec<i8>,)| 808 { 809 wasmtime::component::__internal::Box::new(async move { 810 let host = &mut host_getter(caller.data_mut()); 811 let r = Host::list_s8_param(host, arg0).await; 812 Ok(r) 813 }) 814 }, 815 )?; 816 inst.func_wrap_async( 817 "list-s16-param", 818 move | 819 mut caller: wasmtime::StoreContextMut<'_, T>, 820 (arg0,): (wasmtime::component::__internal::Vec<i16>,)| 821 { 822 wasmtime::component::__internal::Box::new(async move { 823 let host = &mut host_getter(caller.data_mut()); 824 let r = Host::list_s16_param(host, arg0).await; 825 Ok(r) 826 }) 827 }, 828 )?; 829 inst.func_wrap_async( 830 "list-s32-param", 831 move | 832 mut caller: wasmtime::StoreContextMut<'_, T>, 833 (arg0,): (wasmtime::component::__internal::Vec<i32>,)| 834 { 835 wasmtime::component::__internal::Box::new(async move { 836 let host = &mut host_getter(caller.data_mut()); 837 let r = Host::list_s32_param(host, arg0).await; 838 Ok(r) 839 }) 840 }, 841 )?; 842 inst.func_wrap_async( 843 "list-s64-param", 844 move | 845 mut caller: wasmtime::StoreContextMut<'_, T>, 846 (arg0,): (wasmtime::component::__internal::Vec<i64>,)| 847 { 848 wasmtime::component::__internal::Box::new(async move { 849 let host = &mut host_getter(caller.data_mut()); 850 let r = Host::list_s64_param(host, arg0).await; 851 Ok(r) 852 }) 853 }, 854 )?; 855 inst.func_wrap_async( 856 "list-f32-param", 857 move | 858 mut caller: wasmtime::StoreContextMut<'_, T>, 859 (arg0,): (wasmtime::component::__internal::Vec<f32>,)| 860 { 861 wasmtime::component::__internal::Box::new(async move { 862 let host = &mut host_getter(caller.data_mut()); 863 let r = Host::list_f32_param(host, arg0).await; 864 Ok(r) 865 }) 866 }, 867 )?; 868 inst.func_wrap_async( 869 "list-f64-param", 870 move | 871 mut caller: wasmtime::StoreContextMut<'_, T>, 872 (arg0,): (wasmtime::component::__internal::Vec<f64>,)| 873 { 874 wasmtime::component::__internal::Box::new(async move { 875 let host = &mut host_getter(caller.data_mut()); 876 let r = Host::list_f64_param(host, arg0).await; 877 Ok(r) 878 }) 879 }, 880 )?; 881 inst.func_wrap_async( 882 "list-u8-ret", 883 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 884 wasmtime::component::__internal::Box::new(async move { 885 let host = &mut host_getter(caller.data_mut()); 886 let r = Host::list_u8_ret(host).await; 887 Ok((r,)) 888 }) 889 }, 890 )?; 891 inst.func_wrap_async( 892 "list-u16-ret", 893 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 894 wasmtime::component::__internal::Box::new(async move { 895 let host = &mut host_getter(caller.data_mut()); 896 let r = Host::list_u16_ret(host).await; 897 Ok((r,)) 898 }) 899 }, 900 )?; 901 inst.func_wrap_async( 902 "list-u32-ret", 903 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 904 wasmtime::component::__internal::Box::new(async move { 905 let host = &mut host_getter(caller.data_mut()); 906 let r = Host::list_u32_ret(host).await; 907 Ok((r,)) 908 }) 909 }, 910 )?; 911 inst.func_wrap_async( 912 "list-u64-ret", 913 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 914 wasmtime::component::__internal::Box::new(async move { 915 let host = &mut host_getter(caller.data_mut()); 916 let r = Host::list_u64_ret(host).await; 917 Ok((r,)) 918 }) 919 }, 920 )?; 921 inst.func_wrap_async( 922 "list-s8-ret", 923 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 924 wasmtime::component::__internal::Box::new(async move { 925 let host = &mut host_getter(caller.data_mut()); 926 let r = Host::list_s8_ret(host).await; 927 Ok((r,)) 928 }) 929 }, 930 )?; 931 inst.func_wrap_async( 932 "list-s16-ret", 933 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 934 wasmtime::component::__internal::Box::new(async move { 935 let host = &mut host_getter(caller.data_mut()); 936 let r = Host::list_s16_ret(host).await; 937 Ok((r,)) 938 }) 939 }, 940 )?; 941 inst.func_wrap_async( 942 "list-s32-ret", 943 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 944 wasmtime::component::__internal::Box::new(async move { 945 let host = &mut host_getter(caller.data_mut()); 946 let r = Host::list_s32_ret(host).await; 947 Ok((r,)) 948 }) 949 }, 950 )?; 951 inst.func_wrap_async( 952 "list-s64-ret", 953 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 954 wasmtime::component::__internal::Box::new(async move { 955 let host = &mut host_getter(caller.data_mut()); 956 let r = Host::list_s64_ret(host).await; 957 Ok((r,)) 958 }) 959 }, 960 )?; 961 inst.func_wrap_async( 962 "list-f32-ret", 963 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 964 wasmtime::component::__internal::Box::new(async move { 965 let host = &mut host_getter(caller.data_mut()); 966 let r = Host::list_f32_ret(host).await; 967 Ok((r,)) 968 }) 969 }, 970 )?; 971 inst.func_wrap_async( 972 "list-f64-ret", 973 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 974 wasmtime::component::__internal::Box::new(async move { 975 let host = &mut host_getter(caller.data_mut()); 976 let r = Host::list_f64_ret(host).await; 977 Ok((r,)) 978 }) 979 }, 980 )?; 981 inst.func_wrap_async( 982 "tuple-list", 983 move | 984 mut caller: wasmtime::StoreContextMut<'_, T>, 985 (arg0,): (wasmtime::component::__internal::Vec<(u8, i8)>,)| 986 { 987 wasmtime::component::__internal::Box::new(async move { 988 let host = &mut host_getter(caller.data_mut()); 989 let r = Host::tuple_list(host, arg0).await; 990 Ok((r,)) 991 }) 992 }, 993 )?; 994 inst.func_wrap_async( 995 "string-list-arg", 996 move | 997 mut caller: wasmtime::StoreContextMut<'_, T>, 998 ( 999 arg0, 1000 ): ( 1001 wasmtime::component::__internal::Vec< 1002 wasmtime::component::__internal::String, 1003 >, 1004 )| 1005 { 1006 wasmtime::component::__internal::Box::new(async move { 1007 let host = &mut host_getter(caller.data_mut()); 1008 let r = Host::string_list_arg(host, arg0).await; 1009 Ok(r) 1010 }) 1011 }, 1012 )?; 1013 inst.func_wrap_async( 1014 "string-list-ret", 1015 move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| { 1016 wasmtime::component::__internal::Box::new(async move { 1017 let host = &mut host_getter(caller.data_mut()); 1018 let r = Host::string_list_ret(host).await; 1019 Ok((r,)) 1020 }) 1021 }, 1022 )?; 1023 inst.func_wrap_async( 1024 "tuple-string-list", 1025 move | 1026 mut caller: wasmtime::StoreContextMut<'_, T>, 1027 ( 1028 arg0, 1029 ): ( 1030 wasmtime::component::__internal::Vec< 1031 (u8, wasmtime::component::__internal::String), 1032 >, 1033 )| 1034 { 1035 wasmtime::component::__internal::Box::new(async move { 1036 let host = &mut host_getter(caller.data_mut()); 1037 let r = Host::tuple_string_list(host, arg0).await; 1038 Ok((r,)) 1039 }) 1040 }, 1041 )?; 1042 inst.func_wrap_async( 1043 "string-list", 1044 move | 1045 mut caller: wasmtime::StoreContextMut<'_, T>, 1046 ( 1047 arg0, 1048 ): ( 1049 wasmtime::component::__internal::Vec< 1050 wasmtime::component::__internal::String, 1051 >, 1052 )| 1053 { 1054 wasmtime::component::__internal::Box::new(async move { 1055 let host = &mut host_getter(caller.data_mut()); 1056 let r = Host::string_list(host, arg0).await; 1057 Ok((r,)) 1058 }) 1059 }, 1060 )?; 1061 inst.func_wrap_async( 1062 "record-list", 1063 move | 1064 mut caller: wasmtime::StoreContextMut<'_, T>, 1065 (arg0,): (wasmtime::component::__internal::Vec<SomeRecord>,)| 1066 { 1067 wasmtime::component::__internal::Box::new(async move { 1068 let host = &mut host_getter(caller.data_mut()); 1069 let r = Host::record_list(host, arg0).await; 1070 Ok((r,)) 1071 }) 1072 }, 1073 )?; 1074 inst.func_wrap_async( 1075 "record-list-reverse", 1076 move | 1077 mut caller: wasmtime::StoreContextMut<'_, T>, 1078 (arg0,): (wasmtime::component::__internal::Vec<OtherRecord>,)| 1079 { 1080 wasmtime::component::__internal::Box::new(async move { 1081 let host = &mut host_getter(caller.data_mut()); 1082 let r = Host::record_list_reverse(host, arg0).await; 1083 Ok((r,)) 1084 }) 1085 }, 1086 )?; 1087 inst.func_wrap_async( 1088 "variant-list", 1089 move | 1090 mut caller: wasmtime::StoreContextMut<'_, T>, 1091 (arg0,): (wasmtime::component::__internal::Vec<SomeVariant>,)| 1092 { 1093 wasmtime::component::__internal::Box::new(async move { 1094 let host = &mut host_getter(caller.data_mut()); 1095 let r = Host::variant_list(host, arg0).await; 1096 Ok((r,)) 1097 }) 1098 }, 1099 )?; 1100 inst.func_wrap_async( 1101 "load-store-everything", 1102 move | 1103 mut caller: wasmtime::StoreContextMut<'_, T>, 1104 (arg0,): (LoadStoreAllSizes,)| 1105 { 1106 wasmtime::component::__internal::Box::new(async move { 1107 let host = &mut host_getter(caller.data_mut()); 1108 let r = Host::load_store_everything(host, arg0).await; 1109 Ok((r,)) 1110 }) 1111 }, 1112 )?; 1113 Ok(()) 1114 } 1115 } 1116 } 1117 } 1118 pub mod exports { 1119 pub mod foo { 1120 pub mod foo { 1121 #[allow(clippy::all)] 1122 pub mod lists { 1123 #[allow(unused_imports)] 1124 use wasmtime::component::__internal::Box; 1125 #[derive(wasmtime::component::ComponentType)] 1126 #[derive(wasmtime::component::Lift)] 1127 #[derive(wasmtime::component::Lower)] 1128 #[component(record)] 1129 #[derive(Clone)] 1130 pub struct OtherRecord { 1131 #[component(name = "a1")] 1132 pub a1: u32, 1133 #[component(name = "a2")] 1134 pub a2: u64, 1135 #[component(name = "a3")] 1136 pub a3: i32, 1137 #[component(name = "a4")] 1138 pub a4: i64, 1139 #[component(name = "b")] 1140 pub b: wasmtime::component::__internal::String, 1141 #[component(name = "c")] 1142 pub c: wasmtime::component::__internal::Vec<u8>, 1143 } 1144 impl core::fmt::Debug for OtherRecord { 1145 fn fmt( 1146 &self, 1147 f: &mut core::fmt::Formatter<'_>, 1148 ) -> core::fmt::Result { 1149 f.debug_struct("OtherRecord") 1150 .field("a1", &self.a1) 1151 .field("a2", &self.a2) 1152 .field("a3", &self.a3) 1153 .field("a4", &self.a4) 1154 .field("b", &self.b) 1155 .field("c", &self.c) 1156 .finish() 1157 } 1158 } 1159 const _: () = { 1160 assert!( 1161 48 == < OtherRecord as wasmtime::component::ComponentType 1162 >::SIZE32 1163 ); 1164 assert!( 1165 8 == < OtherRecord as wasmtime::component::ComponentType 1166 >::ALIGN32 1167 ); 1168 }; 1169 #[derive(wasmtime::component::ComponentType)] 1170 #[derive(wasmtime::component::Lift)] 1171 #[derive(wasmtime::component::Lower)] 1172 #[component(record)] 1173 #[derive(Clone)] 1174 pub struct SomeRecord { 1175 #[component(name = "x")] 1176 pub x: wasmtime::component::__internal::String, 1177 #[component(name = "y")] 1178 pub y: OtherRecord, 1179 #[component(name = "z")] 1180 pub z: wasmtime::component::__internal::Vec<OtherRecord>, 1181 #[component(name = "c1")] 1182 pub c1: u32, 1183 #[component(name = "c2")] 1184 pub c2: u64, 1185 #[component(name = "c3")] 1186 pub c3: i32, 1187 #[component(name = "c4")] 1188 pub c4: i64, 1189 } 1190 impl core::fmt::Debug for SomeRecord { 1191 fn fmt( 1192 &self, 1193 f: &mut core::fmt::Formatter<'_>, 1194 ) -> core::fmt::Result { 1195 f.debug_struct("SomeRecord") 1196 .field("x", &self.x) 1197 .field("y", &self.y) 1198 .field("z", &self.z) 1199 .field("c1", &self.c1) 1200 .field("c2", &self.c2) 1201 .field("c3", &self.c3) 1202 .field("c4", &self.c4) 1203 .finish() 1204 } 1205 } 1206 const _: () = { 1207 assert!( 1208 96 == < SomeRecord as wasmtime::component::ComponentType 1209 >::SIZE32 1210 ); 1211 assert!( 1212 8 == < SomeRecord as wasmtime::component::ComponentType 1213 >::ALIGN32 1214 ); 1215 }; 1216 #[derive(wasmtime::component::ComponentType)] 1217 #[derive(wasmtime::component::Lift)] 1218 #[derive(wasmtime::component::Lower)] 1219 #[component(variant)] 1220 #[derive(Clone)] 1221 pub enum OtherVariant { 1222 #[component(name = "a")] 1223 A, 1224 #[component(name = "b")] 1225 B(u32), 1226 #[component(name = "c")] 1227 C(wasmtime::component::__internal::String), 1228 } 1229 impl core::fmt::Debug for OtherVariant { 1230 fn fmt( 1231 &self, 1232 f: &mut core::fmt::Formatter<'_>, 1233 ) -> core::fmt::Result { 1234 match self { 1235 OtherVariant::A => f.debug_tuple("OtherVariant::A").finish(), 1236 OtherVariant::B(e) => { 1237 f.debug_tuple("OtherVariant::B").field(e).finish() 1238 } 1239 OtherVariant::C(e) => { 1240 f.debug_tuple("OtherVariant::C").field(e).finish() 1241 } 1242 } 1243 } 1244 } 1245 const _: () = { 1246 assert!( 1247 12 == < OtherVariant as wasmtime::component::ComponentType 1248 >::SIZE32 1249 ); 1250 assert!( 1251 4 == < OtherVariant as wasmtime::component::ComponentType 1252 >::ALIGN32 1253 ); 1254 }; 1255 #[derive(wasmtime::component::ComponentType)] 1256 #[derive(wasmtime::component::Lift)] 1257 #[derive(wasmtime::component::Lower)] 1258 #[component(variant)] 1259 #[derive(Clone)] 1260 pub enum SomeVariant { 1261 #[component(name = "a")] 1262 A(wasmtime::component::__internal::String), 1263 #[component(name = "b")] 1264 B, 1265 #[component(name = "c")] 1266 C(u32), 1267 #[component(name = "d")] 1268 D(wasmtime::component::__internal::Vec<OtherVariant>), 1269 } 1270 impl core::fmt::Debug for SomeVariant { 1271 fn fmt( 1272 &self, 1273 f: &mut core::fmt::Formatter<'_>, 1274 ) -> core::fmt::Result { 1275 match self { 1276 SomeVariant::A(e) => { 1277 f.debug_tuple("SomeVariant::A").field(e).finish() 1278 } 1279 SomeVariant::B => f.debug_tuple("SomeVariant::B").finish(), 1280 SomeVariant::C(e) => { 1281 f.debug_tuple("SomeVariant::C").field(e).finish() 1282 } 1283 SomeVariant::D(e) => { 1284 f.debug_tuple("SomeVariant::D").field(e).finish() 1285 } 1286 } 1287 } 1288 } 1289 const _: () = { 1290 assert!( 1291 12 == < SomeVariant as wasmtime::component::ComponentType 1292 >::SIZE32 1293 ); 1294 assert!( 1295 4 == < SomeVariant as wasmtime::component::ComponentType 1296 >::ALIGN32 1297 ); 1298 }; 1299 pub type LoadStoreAllSizes = wasmtime::component::__internal::Vec< 1300 ( 1301 wasmtime::component::__internal::String, 1302 u8, 1303 i8, 1304 u16, 1305 i16, 1306 u32, 1307 i32, 1308 u64, 1309 i64, 1310 f32, 1311 f64, 1312 char, 1313 ), 1314 >; 1315 const _: () = { 1316 assert!( 1317 8 == < LoadStoreAllSizes as wasmtime::component::ComponentType 1318 >::SIZE32 1319 ); 1320 assert!( 1321 4 == < LoadStoreAllSizes as wasmtime::component::ComponentType 1322 >::ALIGN32 1323 ); 1324 }; 1325 #[derive(Clone)] 1326 pub struct Guest { 1327 list_u8_param: wasmtime::component::Func, 1328 list_u16_param: wasmtime::component::Func, 1329 list_u32_param: wasmtime::component::Func, 1330 list_u64_param: wasmtime::component::Func, 1331 list_s8_param: wasmtime::component::Func, 1332 list_s16_param: wasmtime::component::Func, 1333 list_s32_param: wasmtime::component::Func, 1334 list_s64_param: wasmtime::component::Func, 1335 list_f32_param: wasmtime::component::Func, 1336 list_f64_param: wasmtime::component::Func, 1337 list_u8_ret: wasmtime::component::Func, 1338 list_u16_ret: wasmtime::component::Func, 1339 list_u32_ret: wasmtime::component::Func, 1340 list_u64_ret: wasmtime::component::Func, 1341 list_s8_ret: wasmtime::component::Func, 1342 list_s16_ret: wasmtime::component::Func, 1343 list_s32_ret: wasmtime::component::Func, 1344 list_s64_ret: wasmtime::component::Func, 1345 list_f32_ret: wasmtime::component::Func, 1346 list_f64_ret: wasmtime::component::Func, 1347 tuple_list: wasmtime::component::Func, 1348 string_list_arg: wasmtime::component::Func, 1349 string_list_ret: wasmtime::component::Func, 1350 tuple_string_list: wasmtime::component::Func, 1351 string_list: wasmtime::component::Func, 1352 record_list: wasmtime::component::Func, 1353 record_list_reverse: wasmtime::component::Func, 1354 variant_list: wasmtime::component::Func, 1355 load_store_everything: wasmtime::component::Func, 1356 } 1357 #[derive(Clone)] 1358 pub struct GuestIndices { 1359 list_u8_param: wasmtime::component::ComponentExportIndex, 1360 list_u16_param: wasmtime::component::ComponentExportIndex, 1361 list_u32_param: wasmtime::component::ComponentExportIndex, 1362 list_u64_param: wasmtime::component::ComponentExportIndex, 1363 list_s8_param: wasmtime::component::ComponentExportIndex, 1364 list_s16_param: wasmtime::component::ComponentExportIndex, 1365 list_s32_param: wasmtime::component::ComponentExportIndex, 1366 list_s64_param: wasmtime::component::ComponentExportIndex, 1367 list_f32_param: wasmtime::component::ComponentExportIndex, 1368 list_f64_param: wasmtime::component::ComponentExportIndex, 1369 list_u8_ret: wasmtime::component::ComponentExportIndex, 1370 list_u16_ret: wasmtime::component::ComponentExportIndex, 1371 list_u32_ret: wasmtime::component::ComponentExportIndex, 1372 list_u64_ret: wasmtime::component::ComponentExportIndex, 1373 list_s8_ret: wasmtime::component::ComponentExportIndex, 1374 list_s16_ret: wasmtime::component::ComponentExportIndex, 1375 list_s32_ret: wasmtime::component::ComponentExportIndex, 1376 list_s64_ret: wasmtime::component::ComponentExportIndex, 1377 list_f32_ret: wasmtime::component::ComponentExportIndex, 1378 list_f64_ret: wasmtime::component::ComponentExportIndex, 1379 tuple_list: wasmtime::component::ComponentExportIndex, 1380 string_list_arg: wasmtime::component::ComponentExportIndex, 1381 string_list_ret: wasmtime::component::ComponentExportIndex, 1382 tuple_string_list: wasmtime::component::ComponentExportIndex, 1383 string_list: wasmtime::component::ComponentExportIndex, 1384 record_list: wasmtime::component::ComponentExportIndex, 1385 record_list_reverse: wasmtime::component::ComponentExportIndex, 1386 variant_list: wasmtime::component::ComponentExportIndex, 1387 load_store_everything: wasmtime::component::ComponentExportIndex, 1388 } 1389 impl GuestIndices { 1390 /// Constructor for [`GuestIndices`] which takes a 1391 /// [`Component`](wasmtime::component::Component) as input and can be executed 1392 /// before instantiation. 1393 /// 1394 /// This constructor can be used to front-load string lookups to find exports 1395 /// within a component. 1396 pub fn new<_T>( 1397 _instance_pre: &wasmtime::component::InstancePre<_T>, 1398 ) -> wasmtime::Result<GuestIndices> { 1399 let instance = _instance_pre 1400 .component() 1401 .get_export_index(None, "foo:foo/lists") 1402 .ok_or_else(|| { 1403 wasmtime::format_err!( 1404 "no exported instance named `foo:foo/lists`" 1405 ) 1406 })?; 1407 let mut lookup = move |name| { 1408 _instance_pre 1409 .component() 1410 .get_export_index(Some(&instance), name) 1411 .ok_or_else(|| { 1412 wasmtime::format_err!( 1413 "instance export `foo:foo/lists` does \ 1414 not have export `{name}`" 1415 ) 1416 }) 1417 }; 1418 let _ = &mut lookup; 1419 let list_u8_param = lookup("list-u8-param")?; 1420 let list_u16_param = lookup("list-u16-param")?; 1421 let list_u32_param = lookup("list-u32-param")?; 1422 let list_u64_param = lookup("list-u64-param")?; 1423 let list_s8_param = lookup("list-s8-param")?; 1424 let list_s16_param = lookup("list-s16-param")?; 1425 let list_s32_param = lookup("list-s32-param")?; 1426 let list_s64_param = lookup("list-s64-param")?; 1427 let list_f32_param = lookup("list-f32-param")?; 1428 let list_f64_param = lookup("list-f64-param")?; 1429 let list_u8_ret = lookup("list-u8-ret")?; 1430 let list_u16_ret = lookup("list-u16-ret")?; 1431 let list_u32_ret = lookup("list-u32-ret")?; 1432 let list_u64_ret = lookup("list-u64-ret")?; 1433 let list_s8_ret = lookup("list-s8-ret")?; 1434 let list_s16_ret = lookup("list-s16-ret")?; 1435 let list_s32_ret = lookup("list-s32-ret")?; 1436 let list_s64_ret = lookup("list-s64-ret")?; 1437 let list_f32_ret = lookup("list-f32-ret")?; 1438 let list_f64_ret = lookup("list-f64-ret")?; 1439 let tuple_list = lookup("tuple-list")?; 1440 let string_list_arg = lookup("string-list-arg")?; 1441 let string_list_ret = lookup("string-list-ret")?; 1442 let tuple_string_list = lookup("tuple-string-list")?; 1443 let string_list = lookup("string-list")?; 1444 let record_list = lookup("record-list")?; 1445 let record_list_reverse = lookup("record-list-reverse")?; 1446 let variant_list = lookup("variant-list")?; 1447 let load_store_everything = lookup("load-store-everything")?; 1448 Ok(GuestIndices { 1449 list_u8_param, 1450 list_u16_param, 1451 list_u32_param, 1452 list_u64_param, 1453 list_s8_param, 1454 list_s16_param, 1455 list_s32_param, 1456 list_s64_param, 1457 list_f32_param, 1458 list_f64_param, 1459 list_u8_ret, 1460 list_u16_ret, 1461 list_u32_ret, 1462 list_u64_ret, 1463 list_s8_ret, 1464 list_s16_ret, 1465 list_s32_ret, 1466 list_s64_ret, 1467 list_f32_ret, 1468 list_f64_ret, 1469 tuple_list, 1470 string_list_arg, 1471 string_list_ret, 1472 tuple_string_list, 1473 string_list, 1474 record_list, 1475 record_list_reverse, 1476 variant_list, 1477 load_store_everything, 1478 }) 1479 } 1480 pub fn load( 1481 &self, 1482 mut store: impl wasmtime::AsContextMut, 1483 instance: &wasmtime::component::Instance, 1484 ) -> wasmtime::Result<Guest> { 1485 let _instance = instance; 1486 let _instance_pre = _instance.instance_pre(&store); 1487 let _instance_type = _instance_pre.instance_type(); 1488 let mut store = store.as_context_mut(); 1489 let _ = &mut store; 1490 let list_u8_param = *_instance 1491 .get_typed_func::< 1492 (&[u8],), 1493 (), 1494 >(&mut store, &self.list_u8_param)? 1495 .func(); 1496 let list_u16_param = *_instance 1497 .get_typed_func::< 1498 (&[u16],), 1499 (), 1500 >(&mut store, &self.list_u16_param)? 1501 .func(); 1502 let list_u32_param = *_instance 1503 .get_typed_func::< 1504 (&[u32],), 1505 (), 1506 >(&mut store, &self.list_u32_param)? 1507 .func(); 1508 let list_u64_param = *_instance 1509 .get_typed_func::< 1510 (&[u64],), 1511 (), 1512 >(&mut store, &self.list_u64_param)? 1513 .func(); 1514 let list_s8_param = *_instance 1515 .get_typed_func::< 1516 (&[i8],), 1517 (), 1518 >(&mut store, &self.list_s8_param)? 1519 .func(); 1520 let list_s16_param = *_instance 1521 .get_typed_func::< 1522 (&[i16],), 1523 (), 1524 >(&mut store, &self.list_s16_param)? 1525 .func(); 1526 let list_s32_param = *_instance 1527 .get_typed_func::< 1528 (&[i32],), 1529 (), 1530 >(&mut store, &self.list_s32_param)? 1531 .func(); 1532 let list_s64_param = *_instance 1533 .get_typed_func::< 1534 (&[i64],), 1535 (), 1536 >(&mut store, &self.list_s64_param)? 1537 .func(); 1538 let list_f32_param = *_instance 1539 .get_typed_func::< 1540 (&[f32],), 1541 (), 1542 >(&mut store, &self.list_f32_param)? 1543 .func(); 1544 let list_f64_param = *_instance 1545 .get_typed_func::< 1546 (&[f64],), 1547 (), 1548 >(&mut store, &self.list_f64_param)? 1549 .func(); 1550 let list_u8_ret = *_instance 1551 .get_typed_func::< 1552 (), 1553 (wasmtime::component::__internal::Vec<u8>,), 1554 >(&mut store, &self.list_u8_ret)? 1555 .func(); 1556 let list_u16_ret = *_instance 1557 .get_typed_func::< 1558 (), 1559 (wasmtime::component::__internal::Vec<u16>,), 1560 >(&mut store, &self.list_u16_ret)? 1561 .func(); 1562 let list_u32_ret = *_instance 1563 .get_typed_func::< 1564 (), 1565 (wasmtime::component::__internal::Vec<u32>,), 1566 >(&mut store, &self.list_u32_ret)? 1567 .func(); 1568 let list_u64_ret = *_instance 1569 .get_typed_func::< 1570 (), 1571 (wasmtime::component::__internal::Vec<u64>,), 1572 >(&mut store, &self.list_u64_ret)? 1573 .func(); 1574 let list_s8_ret = *_instance 1575 .get_typed_func::< 1576 (), 1577 (wasmtime::component::__internal::Vec<i8>,), 1578 >(&mut store, &self.list_s8_ret)? 1579 .func(); 1580 let list_s16_ret = *_instance 1581 .get_typed_func::< 1582 (), 1583 (wasmtime::component::__internal::Vec<i16>,), 1584 >(&mut store, &self.list_s16_ret)? 1585 .func(); 1586 let list_s32_ret = *_instance 1587 .get_typed_func::< 1588 (), 1589 (wasmtime::component::__internal::Vec<i32>,), 1590 >(&mut store, &self.list_s32_ret)? 1591 .func(); 1592 let list_s64_ret = *_instance 1593 .get_typed_func::< 1594 (), 1595 (wasmtime::component::__internal::Vec<i64>,), 1596 >(&mut store, &self.list_s64_ret)? 1597 .func(); 1598 let list_f32_ret = *_instance 1599 .get_typed_func::< 1600 (), 1601 (wasmtime::component::__internal::Vec<f32>,), 1602 >(&mut store, &self.list_f32_ret)? 1603 .func(); 1604 let list_f64_ret = *_instance 1605 .get_typed_func::< 1606 (), 1607 (wasmtime::component::__internal::Vec<f64>,), 1608 >(&mut store, &self.list_f64_ret)? 1609 .func(); 1610 let tuple_list = *_instance 1611 .get_typed_func::< 1612 (&[(u8, i8)],), 1613 (wasmtime::component::__internal::Vec<(i64, u32)>,), 1614 >(&mut store, &self.tuple_list)? 1615 .func(); 1616 let string_list_arg = *_instance 1617 .get_typed_func::< 1618 (&[wasmtime::component::__internal::String],), 1619 (), 1620 >(&mut store, &self.string_list_arg)? 1621 .func(); 1622 let string_list_ret = *_instance 1623 .get_typed_func::< 1624 (), 1625 ( 1626 wasmtime::component::__internal::Vec< 1627 wasmtime::component::__internal::String, 1628 >, 1629 ), 1630 >(&mut store, &self.string_list_ret)? 1631 .func(); 1632 let tuple_string_list = *_instance 1633 .get_typed_func::< 1634 (&[(u8, wasmtime::component::__internal::String)],), 1635 ( 1636 wasmtime::component::__internal::Vec< 1637 (wasmtime::component::__internal::String, u8), 1638 >, 1639 ), 1640 >(&mut store, &self.tuple_string_list)? 1641 .func(); 1642 let string_list = *_instance 1643 .get_typed_func::< 1644 (&[wasmtime::component::__internal::String],), 1645 ( 1646 wasmtime::component::__internal::Vec< 1647 wasmtime::component::__internal::String, 1648 >, 1649 ), 1650 >(&mut store, &self.string_list)? 1651 .func(); 1652 let record_list = *_instance 1653 .get_typed_func::< 1654 (&[SomeRecord],), 1655 (wasmtime::component::__internal::Vec<OtherRecord>,), 1656 >(&mut store, &self.record_list)? 1657 .func(); 1658 let record_list_reverse = *_instance 1659 .get_typed_func::< 1660 (&[OtherRecord],), 1661 (wasmtime::component::__internal::Vec<SomeRecord>,), 1662 >(&mut store, &self.record_list_reverse)? 1663 .func(); 1664 let variant_list = *_instance 1665 .get_typed_func::< 1666 (&[SomeVariant],), 1667 (wasmtime::component::__internal::Vec<OtherVariant>,), 1668 >(&mut store, &self.variant_list)? 1669 .func(); 1670 let load_store_everything = *_instance 1671 .get_typed_func::< 1672 (&LoadStoreAllSizes,), 1673 (LoadStoreAllSizes,), 1674 >(&mut store, &self.load_store_everything)? 1675 .func(); 1676 Ok(Guest { 1677 list_u8_param, 1678 list_u16_param, 1679 list_u32_param, 1680 list_u64_param, 1681 list_s8_param, 1682 list_s16_param, 1683 list_s32_param, 1684 list_s64_param, 1685 list_f32_param, 1686 list_f64_param, 1687 list_u8_ret, 1688 list_u16_ret, 1689 list_u32_ret, 1690 list_u64_ret, 1691 list_s8_ret, 1692 list_s16_ret, 1693 list_s32_ret, 1694 list_s64_ret, 1695 list_f32_ret, 1696 list_f64_ret, 1697 tuple_list, 1698 string_list_arg, 1699 string_list_ret, 1700 tuple_string_list, 1701 string_list, 1702 record_list, 1703 record_list_reverse, 1704 variant_list, 1705 load_store_everything, 1706 }) 1707 } 1708 } 1709 impl Guest { 1710 pub async fn call_list_u8_param<S: wasmtime::AsContextMut>( 1711 &self, 1712 mut store: S, 1713 arg0: &[u8], 1714 ) -> wasmtime::Result<()> 1715 where 1716 <S as wasmtime::AsContext>::Data: Send, 1717 { 1718 let callee = unsafe { 1719 wasmtime::component::TypedFunc::< 1720 (&[u8],), 1721 (), 1722 >::new_unchecked(self.list_u8_param) 1723 }; 1724 let () = callee 1725 .call_async(store.as_context_mut(), (arg0,)) 1726 .await?; 1727 Ok(()) 1728 } 1729 pub async fn call_list_u16_param<S: wasmtime::AsContextMut>( 1730 &self, 1731 mut store: S, 1732 arg0: &[u16], 1733 ) -> wasmtime::Result<()> 1734 where 1735 <S as wasmtime::AsContext>::Data: Send, 1736 { 1737 let callee = unsafe { 1738 wasmtime::component::TypedFunc::< 1739 (&[u16],), 1740 (), 1741 >::new_unchecked(self.list_u16_param) 1742 }; 1743 let () = callee 1744 .call_async(store.as_context_mut(), (arg0,)) 1745 .await?; 1746 Ok(()) 1747 } 1748 pub async fn call_list_u32_param<S: wasmtime::AsContextMut>( 1749 &self, 1750 mut store: S, 1751 arg0: &[u32], 1752 ) -> wasmtime::Result<()> 1753 where 1754 <S as wasmtime::AsContext>::Data: Send, 1755 { 1756 let callee = unsafe { 1757 wasmtime::component::TypedFunc::< 1758 (&[u32],), 1759 (), 1760 >::new_unchecked(self.list_u32_param) 1761 }; 1762 let () = callee 1763 .call_async(store.as_context_mut(), (arg0,)) 1764 .await?; 1765 Ok(()) 1766 } 1767 pub async fn call_list_u64_param<S: wasmtime::AsContextMut>( 1768 &self, 1769 mut store: S, 1770 arg0: &[u64], 1771 ) -> wasmtime::Result<()> 1772 where 1773 <S as wasmtime::AsContext>::Data: Send, 1774 { 1775 let callee = unsafe { 1776 wasmtime::component::TypedFunc::< 1777 (&[u64],), 1778 (), 1779 >::new_unchecked(self.list_u64_param) 1780 }; 1781 let () = callee 1782 .call_async(store.as_context_mut(), (arg0,)) 1783 .await?; 1784 Ok(()) 1785 } 1786 pub async fn call_list_s8_param<S: wasmtime::AsContextMut>( 1787 &self, 1788 mut store: S, 1789 arg0: &[i8], 1790 ) -> wasmtime::Result<()> 1791 where 1792 <S as wasmtime::AsContext>::Data: Send, 1793 { 1794 let callee = unsafe { 1795 wasmtime::component::TypedFunc::< 1796 (&[i8],), 1797 (), 1798 >::new_unchecked(self.list_s8_param) 1799 }; 1800 let () = callee 1801 .call_async(store.as_context_mut(), (arg0,)) 1802 .await?; 1803 Ok(()) 1804 } 1805 pub async fn call_list_s16_param<S: wasmtime::AsContextMut>( 1806 &self, 1807 mut store: S, 1808 arg0: &[i16], 1809 ) -> wasmtime::Result<()> 1810 where 1811 <S as wasmtime::AsContext>::Data: Send, 1812 { 1813 let callee = unsafe { 1814 wasmtime::component::TypedFunc::< 1815 (&[i16],), 1816 (), 1817 >::new_unchecked(self.list_s16_param) 1818 }; 1819 let () = callee 1820 .call_async(store.as_context_mut(), (arg0,)) 1821 .await?; 1822 Ok(()) 1823 } 1824 pub async fn call_list_s32_param<S: wasmtime::AsContextMut>( 1825 &self, 1826 mut store: S, 1827 arg0: &[i32], 1828 ) -> wasmtime::Result<()> 1829 where 1830 <S as wasmtime::AsContext>::Data: Send, 1831 { 1832 let callee = unsafe { 1833 wasmtime::component::TypedFunc::< 1834 (&[i32],), 1835 (), 1836 >::new_unchecked(self.list_s32_param) 1837 }; 1838 let () = callee 1839 .call_async(store.as_context_mut(), (arg0,)) 1840 .await?; 1841 Ok(()) 1842 } 1843 pub async fn call_list_s64_param<S: wasmtime::AsContextMut>( 1844 &self, 1845 mut store: S, 1846 arg0: &[i64], 1847 ) -> wasmtime::Result<()> 1848 where 1849 <S as wasmtime::AsContext>::Data: Send, 1850 { 1851 let callee = unsafe { 1852 wasmtime::component::TypedFunc::< 1853 (&[i64],), 1854 (), 1855 >::new_unchecked(self.list_s64_param) 1856 }; 1857 let () = callee 1858 .call_async(store.as_context_mut(), (arg0,)) 1859 .await?; 1860 Ok(()) 1861 } 1862 pub async fn call_list_f32_param<S: wasmtime::AsContextMut>( 1863 &self, 1864 mut store: S, 1865 arg0: &[f32], 1866 ) -> wasmtime::Result<()> 1867 where 1868 <S as wasmtime::AsContext>::Data: Send, 1869 { 1870 let callee = unsafe { 1871 wasmtime::component::TypedFunc::< 1872 (&[f32],), 1873 (), 1874 >::new_unchecked(self.list_f32_param) 1875 }; 1876 let () = callee 1877 .call_async(store.as_context_mut(), (arg0,)) 1878 .await?; 1879 Ok(()) 1880 } 1881 pub async fn call_list_f64_param<S: wasmtime::AsContextMut>( 1882 &self, 1883 mut store: S, 1884 arg0: &[f64], 1885 ) -> wasmtime::Result<()> 1886 where 1887 <S as wasmtime::AsContext>::Data: Send, 1888 { 1889 let callee = unsafe { 1890 wasmtime::component::TypedFunc::< 1891 (&[f64],), 1892 (), 1893 >::new_unchecked(self.list_f64_param) 1894 }; 1895 let () = callee 1896 .call_async(store.as_context_mut(), (arg0,)) 1897 .await?; 1898 Ok(()) 1899 } 1900 pub async fn call_list_u8_ret<S: wasmtime::AsContextMut>( 1901 &self, 1902 mut store: S, 1903 ) -> wasmtime::Result<wasmtime::component::__internal::Vec<u8>> 1904 where 1905 <S as wasmtime::AsContext>::Data: Send, 1906 { 1907 let callee = unsafe { 1908 wasmtime::component::TypedFunc::< 1909 (), 1910 (wasmtime::component::__internal::Vec<u8>,), 1911 >::new_unchecked(self.list_u8_ret) 1912 }; 1913 let (ret0,) = callee 1914 .call_async(store.as_context_mut(), ()) 1915 .await?; 1916 Ok(ret0) 1917 } 1918 pub async fn call_list_u16_ret<S: wasmtime::AsContextMut>( 1919 &self, 1920 mut store: S, 1921 ) -> wasmtime::Result<wasmtime::component::__internal::Vec<u16>> 1922 where 1923 <S as wasmtime::AsContext>::Data: Send, 1924 { 1925 let callee = unsafe { 1926 wasmtime::component::TypedFunc::< 1927 (), 1928 (wasmtime::component::__internal::Vec<u16>,), 1929 >::new_unchecked(self.list_u16_ret) 1930 }; 1931 let (ret0,) = callee 1932 .call_async(store.as_context_mut(), ()) 1933 .await?; 1934 Ok(ret0) 1935 } 1936 pub async fn call_list_u32_ret<S: wasmtime::AsContextMut>( 1937 &self, 1938 mut store: S, 1939 ) -> wasmtime::Result<wasmtime::component::__internal::Vec<u32>> 1940 where 1941 <S as wasmtime::AsContext>::Data: Send, 1942 { 1943 let callee = unsafe { 1944 wasmtime::component::TypedFunc::< 1945 (), 1946 (wasmtime::component::__internal::Vec<u32>,), 1947 >::new_unchecked(self.list_u32_ret) 1948 }; 1949 let (ret0,) = callee 1950 .call_async(store.as_context_mut(), ()) 1951 .await?; 1952 Ok(ret0) 1953 } 1954 pub async fn call_list_u64_ret<S: wasmtime::AsContextMut>( 1955 &self, 1956 mut store: S, 1957 ) -> wasmtime::Result<wasmtime::component::__internal::Vec<u64>> 1958 where 1959 <S as wasmtime::AsContext>::Data: Send, 1960 { 1961 let callee = unsafe { 1962 wasmtime::component::TypedFunc::< 1963 (), 1964 (wasmtime::component::__internal::Vec<u64>,), 1965 >::new_unchecked(self.list_u64_ret) 1966 }; 1967 let (ret0,) = callee 1968 .call_async(store.as_context_mut(), ()) 1969 .await?; 1970 Ok(ret0) 1971 } 1972 pub async fn call_list_s8_ret<S: wasmtime::AsContextMut>( 1973 &self, 1974 mut store: S, 1975 ) -> wasmtime::Result<wasmtime::component::__internal::Vec<i8>> 1976 where 1977 <S as wasmtime::AsContext>::Data: Send, 1978 { 1979 let callee = unsafe { 1980 wasmtime::component::TypedFunc::< 1981 (), 1982 (wasmtime::component::__internal::Vec<i8>,), 1983 >::new_unchecked(self.list_s8_ret) 1984 }; 1985 let (ret0,) = callee 1986 .call_async(store.as_context_mut(), ()) 1987 .await?; 1988 Ok(ret0) 1989 } 1990 pub async fn call_list_s16_ret<S: wasmtime::AsContextMut>( 1991 &self, 1992 mut store: S, 1993 ) -> wasmtime::Result<wasmtime::component::__internal::Vec<i16>> 1994 where 1995 <S as wasmtime::AsContext>::Data: Send, 1996 { 1997 let callee = unsafe { 1998 wasmtime::component::TypedFunc::< 1999 (), 2000 (wasmtime::component::__internal::Vec<i16>,), 2001 >::new_unchecked(self.list_s16_ret) 2002 }; 2003 let (ret0,) = callee 2004 .call_async(store.as_context_mut(), ()) 2005 .await?; 2006 Ok(ret0) 2007 } 2008 pub async fn call_list_s32_ret<S: wasmtime::AsContextMut>( 2009 &self, 2010 mut store: S, 2011 ) -> wasmtime::Result<wasmtime::component::__internal::Vec<i32>> 2012 where 2013 <S as wasmtime::AsContext>::Data: Send, 2014 { 2015 let callee = unsafe { 2016 wasmtime::component::TypedFunc::< 2017 (), 2018 (wasmtime::component::__internal::Vec<i32>,), 2019 >::new_unchecked(self.list_s32_ret) 2020 }; 2021 let (ret0,) = callee 2022 .call_async(store.as_context_mut(), ()) 2023 .await?; 2024 Ok(ret0) 2025 } 2026 pub async fn call_list_s64_ret<S: wasmtime::AsContextMut>( 2027 &self, 2028 mut store: S, 2029 ) -> wasmtime::Result<wasmtime::component::__internal::Vec<i64>> 2030 where 2031 <S as wasmtime::AsContext>::Data: Send, 2032 { 2033 let callee = unsafe { 2034 wasmtime::component::TypedFunc::< 2035 (), 2036 (wasmtime::component::__internal::Vec<i64>,), 2037 >::new_unchecked(self.list_s64_ret) 2038 }; 2039 let (ret0,) = callee 2040 .call_async(store.as_context_mut(), ()) 2041 .await?; 2042 Ok(ret0) 2043 } 2044 pub async fn call_list_f32_ret<S: wasmtime::AsContextMut>( 2045 &self, 2046 mut store: S, 2047 ) -> wasmtime::Result<wasmtime::component::__internal::Vec<f32>> 2048 where 2049 <S as wasmtime::AsContext>::Data: Send, 2050 { 2051 let callee = unsafe { 2052 wasmtime::component::TypedFunc::< 2053 (), 2054 (wasmtime::component::__internal::Vec<f32>,), 2055 >::new_unchecked(self.list_f32_ret) 2056 }; 2057 let (ret0,) = callee 2058 .call_async(store.as_context_mut(), ()) 2059 .await?; 2060 Ok(ret0) 2061 } 2062 pub async fn call_list_f64_ret<S: wasmtime::AsContextMut>( 2063 &self, 2064 mut store: S, 2065 ) -> wasmtime::Result<wasmtime::component::__internal::Vec<f64>> 2066 where 2067 <S as wasmtime::AsContext>::Data: Send, 2068 { 2069 let callee = unsafe { 2070 wasmtime::component::TypedFunc::< 2071 (), 2072 (wasmtime::component::__internal::Vec<f64>,), 2073 >::new_unchecked(self.list_f64_ret) 2074 }; 2075 let (ret0,) = callee 2076 .call_async(store.as_context_mut(), ()) 2077 .await?; 2078 Ok(ret0) 2079 } 2080 pub async fn call_tuple_list<S: wasmtime::AsContextMut>( 2081 &self, 2082 mut store: S, 2083 arg0: &[(u8, i8)], 2084 ) -> wasmtime::Result< 2085 wasmtime::component::__internal::Vec<(i64, u32)>, 2086 > 2087 where 2088 <S as wasmtime::AsContext>::Data: Send, 2089 { 2090 let callee = unsafe { 2091 wasmtime::component::TypedFunc::< 2092 (&[(u8, i8)],), 2093 (wasmtime::component::__internal::Vec<(i64, u32)>,), 2094 >::new_unchecked(self.tuple_list) 2095 }; 2096 let (ret0,) = callee 2097 .call_async(store.as_context_mut(), (arg0,)) 2098 .await?; 2099 Ok(ret0) 2100 } 2101 pub async fn call_string_list_arg<S: wasmtime::AsContextMut>( 2102 &self, 2103 mut store: S, 2104 arg0: &[wasmtime::component::__internal::String], 2105 ) -> wasmtime::Result<()> 2106 where 2107 <S as wasmtime::AsContext>::Data: Send, 2108 { 2109 let callee = unsafe { 2110 wasmtime::component::TypedFunc::< 2111 (&[wasmtime::component::__internal::String],), 2112 (), 2113 >::new_unchecked(self.string_list_arg) 2114 }; 2115 let () = callee 2116 .call_async(store.as_context_mut(), (arg0,)) 2117 .await?; 2118 Ok(()) 2119 } 2120 pub async fn call_string_list_ret<S: wasmtime::AsContextMut>( 2121 &self, 2122 mut store: S, 2123 ) -> wasmtime::Result< 2124 wasmtime::component::__internal::Vec< 2125 wasmtime::component::__internal::String, 2126 >, 2127 > 2128 where 2129 <S as wasmtime::AsContext>::Data: Send, 2130 { 2131 let callee = unsafe { 2132 wasmtime::component::TypedFunc::< 2133 (), 2134 ( 2135 wasmtime::component::__internal::Vec< 2136 wasmtime::component::__internal::String, 2137 >, 2138 ), 2139 >::new_unchecked(self.string_list_ret) 2140 }; 2141 let (ret0,) = callee 2142 .call_async(store.as_context_mut(), ()) 2143 .await?; 2144 Ok(ret0) 2145 } 2146 pub async fn call_tuple_string_list<S: wasmtime::AsContextMut>( 2147 &self, 2148 mut store: S, 2149 arg0: &[(u8, wasmtime::component::__internal::String)], 2150 ) -> wasmtime::Result< 2151 wasmtime::component::__internal::Vec< 2152 (wasmtime::component::__internal::String, u8), 2153 >, 2154 > 2155 where 2156 <S as wasmtime::AsContext>::Data: Send, 2157 { 2158 let callee = unsafe { 2159 wasmtime::component::TypedFunc::< 2160 (&[(u8, wasmtime::component::__internal::String)],), 2161 ( 2162 wasmtime::component::__internal::Vec< 2163 (wasmtime::component::__internal::String, u8), 2164 >, 2165 ), 2166 >::new_unchecked(self.tuple_string_list) 2167 }; 2168 let (ret0,) = callee 2169 .call_async(store.as_context_mut(), (arg0,)) 2170 .await?; 2171 Ok(ret0) 2172 } 2173 pub async fn call_string_list<S: wasmtime::AsContextMut>( 2174 &self, 2175 mut store: S, 2176 arg0: &[wasmtime::component::__internal::String], 2177 ) -> wasmtime::Result< 2178 wasmtime::component::__internal::Vec< 2179 wasmtime::component::__internal::String, 2180 >, 2181 > 2182 where 2183 <S as wasmtime::AsContext>::Data: Send, 2184 { 2185 let callee = unsafe { 2186 wasmtime::component::TypedFunc::< 2187 (&[wasmtime::component::__internal::String],), 2188 ( 2189 wasmtime::component::__internal::Vec< 2190 wasmtime::component::__internal::String, 2191 >, 2192 ), 2193 >::new_unchecked(self.string_list) 2194 }; 2195 let (ret0,) = callee 2196 .call_async(store.as_context_mut(), (arg0,)) 2197 .await?; 2198 Ok(ret0) 2199 } 2200 pub async fn call_record_list<S: wasmtime::AsContextMut>( 2201 &self, 2202 mut store: S, 2203 arg0: &[SomeRecord], 2204 ) -> wasmtime::Result< 2205 wasmtime::component::__internal::Vec<OtherRecord>, 2206 > 2207 where 2208 <S as wasmtime::AsContext>::Data: Send, 2209 { 2210 let callee = unsafe { 2211 wasmtime::component::TypedFunc::< 2212 (&[SomeRecord],), 2213 (wasmtime::component::__internal::Vec<OtherRecord>,), 2214 >::new_unchecked(self.record_list) 2215 }; 2216 let (ret0,) = callee 2217 .call_async(store.as_context_mut(), (arg0,)) 2218 .await?; 2219 Ok(ret0) 2220 } 2221 pub async fn call_record_list_reverse<S: wasmtime::AsContextMut>( 2222 &self, 2223 mut store: S, 2224 arg0: &[OtherRecord], 2225 ) -> wasmtime::Result< 2226 wasmtime::component::__internal::Vec<SomeRecord>, 2227 > 2228 where 2229 <S as wasmtime::AsContext>::Data: Send, 2230 { 2231 let callee = unsafe { 2232 wasmtime::component::TypedFunc::< 2233 (&[OtherRecord],), 2234 (wasmtime::component::__internal::Vec<SomeRecord>,), 2235 >::new_unchecked(self.record_list_reverse) 2236 }; 2237 let (ret0,) = callee 2238 .call_async(store.as_context_mut(), (arg0,)) 2239 .await?; 2240 Ok(ret0) 2241 } 2242 pub async fn call_variant_list<S: wasmtime::AsContextMut>( 2243 &self, 2244 mut store: S, 2245 arg0: &[SomeVariant], 2246 ) -> wasmtime::Result< 2247 wasmtime::component::__internal::Vec<OtherVariant>, 2248 > 2249 where 2250 <S as wasmtime::AsContext>::Data: Send, 2251 { 2252 let callee = unsafe { 2253 wasmtime::component::TypedFunc::< 2254 (&[SomeVariant],), 2255 (wasmtime::component::__internal::Vec<OtherVariant>,), 2256 >::new_unchecked(self.variant_list) 2257 }; 2258 let (ret0,) = callee 2259 .call_async(store.as_context_mut(), (arg0,)) 2260 .await?; 2261 Ok(ret0) 2262 } 2263 pub async fn call_load_store_everything<S: wasmtime::AsContextMut>( 2264 &self, 2265 mut store: S, 2266 arg0: &LoadStoreAllSizes, 2267 ) -> wasmtime::Result<LoadStoreAllSizes> 2268 where 2269 <S as wasmtime::AsContext>::Data: Send, 2270 { 2271 let callee = unsafe { 2272 wasmtime::component::TypedFunc::< 2273 (&LoadStoreAllSizes,), 2274 (LoadStoreAllSizes,), 2275 >::new_unchecked(self.load_store_everything) 2276 }; 2277 let (ret0,) = callee 2278 .call_async(store.as_context_mut(), (arg0,)) 2279 .await?; 2280 Ok(ret0) 2281 } 2282 } 2283 } 2284 } 2285 } 2286 } 2287