1 /// Auto-generated bindings for a pre-instantiated version of a 2 /// component which implements the world `the-world`. 3 /// 4 /// This structure is created through [`TheWorldPre::new`] which 5 /// takes a [`InstancePre`](wasmtime::component::InstancePre) that 6 /// has been created through a [`Linker`](wasmtime::component::Linker). 7 /// 8 /// For more information see [`TheWorld`] as well. 9 pub struct TheWorldPre<T: 'static> { 10 instance_pre: wasmtime::component::InstancePre<T>, 11 indices: TheWorldIndices, 12 } 13 impl<T: 'static> Clone for TheWorldPre<T> { 14 fn clone(&self) -> Self { 15 Self { 16 instance_pre: self.instance_pre.clone(), 17 indices: self.indices.clone(), 18 } 19 } 20 } 21 impl<_T: 'static> TheWorldPre<_T> { 22 /// Creates a new copy of `TheWorldPre` bindings which can then 23 /// be used to instantiate into a particular store. 24 /// 25 /// This method may fail if the component behind `instance_pre` 26 /// does not have the required exports. 27 pub fn new( 28 instance_pre: wasmtime::component::InstancePre<_T>, 29 ) -> wasmtime::Result<Self> { 30 let indices = TheWorldIndices::new(&instance_pre)?; 31 Ok(Self { instance_pre, indices }) 32 } 33 pub fn engine(&self) -> &wasmtime::Engine { 34 self.instance_pre.engine() 35 } 36 pub fn instance_pre(&self) -> &wasmtime::component::InstancePre<_T> { 37 &self.instance_pre 38 } 39 /// Instantiates a new instance of [`TheWorld`] within the 40 /// `store` provided. 41 /// 42 /// This function will use `self` as the pre-instantiated 43 /// instance to perform instantiation. Afterwards the preloaded 44 /// indices in `self` are used to lookup all exports on the 45 /// resulting instance. 46 pub fn instantiate( 47 &self, 48 mut store: impl wasmtime::AsContextMut<Data = _T>, 49 ) -> wasmtime::Result<TheWorld> { 50 let mut store = store.as_context_mut(); 51 let instance = self.instance_pre.instantiate(&mut store)?; 52 self.indices.load(&mut store, &instance) 53 } 54 } 55 impl<_T: Send + 'static> TheWorldPre<_T> { 56 /// Same as [`Self::instantiate`], except with `async`. 57 pub async fn instantiate_async( 58 &self, 59 mut store: impl wasmtime::AsContextMut<Data = _T>, 60 ) -> wasmtime::Result<TheWorld> { 61 let mut store = store.as_context_mut(); 62 let instance = self.instance_pre.instantiate_async(&mut store).await?; 63 self.indices.load(&mut store, &instance) 64 } 65 } 66 /// Auto-generated bindings for index of the exports of 67 /// `the-world`. 68 /// 69 /// This is an implementation detail of [`TheWorldPre`] and can 70 /// be constructed if needed as well. 71 /// 72 /// For more information see [`TheWorld`] as well. 73 #[derive(Clone)] 74 pub struct TheWorldIndices { 75 interface0: exports::foo::foo::integers::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::integers::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. 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::integers::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. 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`]. 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`]. 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`]. 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 } 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::integers::HostWithStore + Send, 177 for<'a> D::Data<'a>: foo::foo::integers::Host + Send, 178 T: 'static + Send, 179 { 180 foo::foo::integers::add_to_linker::<T, D>(linker, host_getter)?; 181 Ok(()) 182 } 183 pub fn foo_foo_integers(&self) -> &exports::foo::foo::integers::Guest { 184 &self.interface0 185 } 186 } 187 }; 188 pub mod foo { 189 pub mod foo { 190 #[allow(clippy::all)] 191 pub mod integers { 192 #[allow(unused_imports)] 193 use wasmtime::component::__internal::Box; 194 pub trait HostWithStore: wasmtime::component::HasData + Send { 195 fn a1<T: Send>( 196 accessor: &wasmtime::component::Accessor<T, Self>, 197 x: u8, 198 ) -> impl ::core::future::Future<Output = ()> + Send; 199 fn a2<T: Send>( 200 accessor: &wasmtime::component::Accessor<T, Self>, 201 x: i8, 202 ) -> impl ::core::future::Future<Output = ()> + Send; 203 fn a3<T: Send>( 204 accessor: &wasmtime::component::Accessor<T, Self>, 205 x: u16, 206 ) -> impl ::core::future::Future<Output = ()> + Send; 207 fn a4<T: Send>( 208 accessor: &wasmtime::component::Accessor<T, Self>, 209 x: i16, 210 ) -> impl ::core::future::Future<Output = ()> + Send; 211 fn a5<T: Send>( 212 accessor: &wasmtime::component::Accessor<T, Self>, 213 x: u32, 214 ) -> impl ::core::future::Future<Output = ()> + Send; 215 fn a6<T: Send>( 216 accessor: &wasmtime::component::Accessor<T, Self>, 217 x: i32, 218 ) -> impl ::core::future::Future<Output = ()> + Send; 219 fn a7<T: Send>( 220 accessor: &wasmtime::component::Accessor<T, Self>, 221 x: u64, 222 ) -> impl ::core::future::Future<Output = ()> + Send; 223 fn a8<T: Send>( 224 accessor: &wasmtime::component::Accessor<T, Self>, 225 x: i64, 226 ) -> impl ::core::future::Future<Output = ()> + Send; 227 fn a9<T: Send>( 228 accessor: &wasmtime::component::Accessor<T, Self>, 229 p1: u8, 230 p2: i8, 231 p3: u16, 232 p4: i16, 233 p5: u32, 234 p6: i32, 235 p7: u64, 236 p8: i64, 237 ) -> impl ::core::future::Future<Output = ()> + Send; 238 fn r1<T: Send>( 239 accessor: &wasmtime::component::Accessor<T, Self>, 240 ) -> impl ::core::future::Future<Output = u8> + Send; 241 fn r2<T: Send>( 242 accessor: &wasmtime::component::Accessor<T, Self>, 243 ) -> impl ::core::future::Future<Output = i8> + Send; 244 fn r3<T: Send>( 245 accessor: &wasmtime::component::Accessor<T, Self>, 246 ) -> impl ::core::future::Future<Output = u16> + Send; 247 fn r4<T: Send>( 248 accessor: &wasmtime::component::Accessor<T, Self>, 249 ) -> impl ::core::future::Future<Output = i16> + Send; 250 fn r5<T: Send>( 251 accessor: &wasmtime::component::Accessor<T, Self>, 252 ) -> impl ::core::future::Future<Output = u32> + Send; 253 fn r6<T: Send>( 254 accessor: &wasmtime::component::Accessor<T, Self>, 255 ) -> impl ::core::future::Future<Output = i32> + Send; 256 fn r7<T: Send>( 257 accessor: &wasmtime::component::Accessor<T, Self>, 258 ) -> impl ::core::future::Future<Output = u64> + Send; 259 fn r8<T: Send>( 260 accessor: &wasmtime::component::Accessor<T, Self>, 261 ) -> impl ::core::future::Future<Output = i64> + Send; 262 fn pair_ret<T: Send>( 263 accessor: &wasmtime::component::Accessor<T, Self>, 264 ) -> impl ::core::future::Future<Output = (i64, u8)> + Send; 265 } 266 pub trait Host: Send {} 267 impl<_T: Host + ?Sized + Send> Host for &mut _T {} 268 pub fn add_to_linker<T, D>( 269 linker: &mut wasmtime::component::Linker<T>, 270 host_getter: fn(&mut T) -> D::Data<'_>, 271 ) -> wasmtime::Result<()> 272 where 273 D: HostWithStore, 274 for<'a> D::Data<'a>: Host, 275 T: 'static + Send, 276 { 277 let mut inst = linker.instance("foo:foo/integers")?; 278 inst.func_wrap_concurrent( 279 "a1", 280 move |caller: &wasmtime::component::Accessor<T>, (arg0,): (u8,)| { 281 wasmtime::component::__internal::Box::pin(async move { 282 let host = &caller.with_getter(host_getter); 283 let r = <D as HostWithStore>::a1(host, arg0).await; 284 Ok(r) 285 }) 286 }, 287 )?; 288 inst.func_wrap_concurrent( 289 "a2", 290 move |caller: &wasmtime::component::Accessor<T>, (arg0,): (i8,)| { 291 wasmtime::component::__internal::Box::pin(async move { 292 let host = &caller.with_getter(host_getter); 293 let r = <D as HostWithStore>::a2(host, arg0).await; 294 Ok(r) 295 }) 296 }, 297 )?; 298 inst.func_wrap_concurrent( 299 "a3", 300 move |caller: &wasmtime::component::Accessor<T>, (arg0,): (u16,)| { 301 wasmtime::component::__internal::Box::pin(async move { 302 let host = &caller.with_getter(host_getter); 303 let r = <D as HostWithStore>::a3(host, arg0).await; 304 Ok(r) 305 }) 306 }, 307 )?; 308 inst.func_wrap_concurrent( 309 "a4", 310 move |caller: &wasmtime::component::Accessor<T>, (arg0,): (i16,)| { 311 wasmtime::component::__internal::Box::pin(async move { 312 let host = &caller.with_getter(host_getter); 313 let r = <D as HostWithStore>::a4(host, arg0).await; 314 Ok(r) 315 }) 316 }, 317 )?; 318 inst.func_wrap_concurrent( 319 "a5", 320 move |caller: &wasmtime::component::Accessor<T>, (arg0,): (u32,)| { 321 wasmtime::component::__internal::Box::pin(async move { 322 let host = &caller.with_getter(host_getter); 323 let r = <D as HostWithStore>::a5(host, arg0).await; 324 Ok(r) 325 }) 326 }, 327 )?; 328 inst.func_wrap_concurrent( 329 "a6", 330 move |caller: &wasmtime::component::Accessor<T>, (arg0,): (i32,)| { 331 wasmtime::component::__internal::Box::pin(async move { 332 let host = &caller.with_getter(host_getter); 333 let r = <D as HostWithStore>::a6(host, arg0).await; 334 Ok(r) 335 }) 336 }, 337 )?; 338 inst.func_wrap_concurrent( 339 "a7", 340 move |caller: &wasmtime::component::Accessor<T>, (arg0,): (u64,)| { 341 wasmtime::component::__internal::Box::pin(async move { 342 let host = &caller.with_getter(host_getter); 343 let r = <D as HostWithStore>::a7(host, arg0).await; 344 Ok(r) 345 }) 346 }, 347 )?; 348 inst.func_wrap_concurrent( 349 "a8", 350 move |caller: &wasmtime::component::Accessor<T>, (arg0,): (i64,)| { 351 wasmtime::component::__internal::Box::pin(async move { 352 let host = &caller.with_getter(host_getter); 353 let r = <D as HostWithStore>::a8(host, arg0).await; 354 Ok(r) 355 }) 356 }, 357 )?; 358 inst.func_wrap_concurrent( 359 "a9", 360 move | 361 caller: &wasmtime::component::Accessor<T>, 362 ( 363 arg0, 364 arg1, 365 arg2, 366 arg3, 367 arg4, 368 arg5, 369 arg6, 370 arg7, 371 ): (u8, i8, u16, i16, u32, i32, u64, i64)| 372 { 373 wasmtime::component::__internal::Box::pin(async move { 374 let host = &caller.with_getter(host_getter); 375 let r = <D as HostWithStore>::a9( 376 host, 377 arg0, 378 arg1, 379 arg2, 380 arg3, 381 arg4, 382 arg5, 383 arg6, 384 arg7, 385 ) 386 .await; 387 Ok(r) 388 }) 389 }, 390 )?; 391 inst.func_wrap_concurrent( 392 "r1", 393 move |caller: &wasmtime::component::Accessor<T>, (): ()| { 394 wasmtime::component::__internal::Box::pin(async move { 395 let host = &caller.with_getter(host_getter); 396 let r = <D as HostWithStore>::r1(host).await; 397 Ok((r,)) 398 }) 399 }, 400 )?; 401 inst.func_wrap_concurrent( 402 "r2", 403 move |caller: &wasmtime::component::Accessor<T>, (): ()| { 404 wasmtime::component::__internal::Box::pin(async move { 405 let host = &caller.with_getter(host_getter); 406 let r = <D as HostWithStore>::r2(host).await; 407 Ok((r,)) 408 }) 409 }, 410 )?; 411 inst.func_wrap_concurrent( 412 "r3", 413 move |caller: &wasmtime::component::Accessor<T>, (): ()| { 414 wasmtime::component::__internal::Box::pin(async move { 415 let host = &caller.with_getter(host_getter); 416 let r = <D as HostWithStore>::r3(host).await; 417 Ok((r,)) 418 }) 419 }, 420 )?; 421 inst.func_wrap_concurrent( 422 "r4", 423 move |caller: &wasmtime::component::Accessor<T>, (): ()| { 424 wasmtime::component::__internal::Box::pin(async move { 425 let host = &caller.with_getter(host_getter); 426 let r = <D as HostWithStore>::r4(host).await; 427 Ok((r,)) 428 }) 429 }, 430 )?; 431 inst.func_wrap_concurrent( 432 "r5", 433 move |caller: &wasmtime::component::Accessor<T>, (): ()| { 434 wasmtime::component::__internal::Box::pin(async move { 435 let host = &caller.with_getter(host_getter); 436 let r = <D as HostWithStore>::r5(host).await; 437 Ok((r,)) 438 }) 439 }, 440 )?; 441 inst.func_wrap_concurrent( 442 "r6", 443 move |caller: &wasmtime::component::Accessor<T>, (): ()| { 444 wasmtime::component::__internal::Box::pin(async move { 445 let host = &caller.with_getter(host_getter); 446 let r = <D as HostWithStore>::r6(host).await; 447 Ok((r,)) 448 }) 449 }, 450 )?; 451 inst.func_wrap_concurrent( 452 "r7", 453 move |caller: &wasmtime::component::Accessor<T>, (): ()| { 454 wasmtime::component::__internal::Box::pin(async move { 455 let host = &caller.with_getter(host_getter); 456 let r = <D as HostWithStore>::r7(host).await; 457 Ok((r,)) 458 }) 459 }, 460 )?; 461 inst.func_wrap_concurrent( 462 "r8", 463 move |caller: &wasmtime::component::Accessor<T>, (): ()| { 464 wasmtime::component::__internal::Box::pin(async move { 465 let host = &caller.with_getter(host_getter); 466 let r = <D as HostWithStore>::r8(host).await; 467 Ok((r,)) 468 }) 469 }, 470 )?; 471 inst.func_wrap_concurrent( 472 "pair-ret", 473 move |caller: &wasmtime::component::Accessor<T>, (): ()| { 474 wasmtime::component::__internal::Box::pin(async move { 475 let host = &caller.with_getter(host_getter); 476 let r = <D as HostWithStore>::pair_ret(host).await; 477 Ok((r,)) 478 }) 479 }, 480 )?; 481 Ok(()) 482 } 483 } 484 } 485 } 486 pub mod exports { 487 pub mod foo { 488 pub mod foo { 489 #[allow(clippy::all)] 490 pub mod integers { 491 #[allow(unused_imports)] 492 use wasmtime::component::__internal::Box; 493 #[derive(Clone)] 494 pub struct Guest { 495 a1: wasmtime::component::Func, 496 a2: wasmtime::component::Func, 497 a3: wasmtime::component::Func, 498 a4: wasmtime::component::Func, 499 a5: wasmtime::component::Func, 500 a6: wasmtime::component::Func, 501 a7: wasmtime::component::Func, 502 a8: wasmtime::component::Func, 503 a9: wasmtime::component::Func, 504 r1: wasmtime::component::Func, 505 r2: wasmtime::component::Func, 506 r3: wasmtime::component::Func, 507 r4: wasmtime::component::Func, 508 r5: wasmtime::component::Func, 509 r6: wasmtime::component::Func, 510 r7: wasmtime::component::Func, 511 r8: wasmtime::component::Func, 512 pair_ret: wasmtime::component::Func, 513 } 514 #[derive(Clone)] 515 pub struct GuestIndices { 516 a1: wasmtime::component::ComponentExportIndex, 517 a2: wasmtime::component::ComponentExportIndex, 518 a3: wasmtime::component::ComponentExportIndex, 519 a4: wasmtime::component::ComponentExportIndex, 520 a5: wasmtime::component::ComponentExportIndex, 521 a6: wasmtime::component::ComponentExportIndex, 522 a7: wasmtime::component::ComponentExportIndex, 523 a8: wasmtime::component::ComponentExportIndex, 524 a9: wasmtime::component::ComponentExportIndex, 525 r1: wasmtime::component::ComponentExportIndex, 526 r2: wasmtime::component::ComponentExportIndex, 527 r3: wasmtime::component::ComponentExportIndex, 528 r4: wasmtime::component::ComponentExportIndex, 529 r5: wasmtime::component::ComponentExportIndex, 530 r6: wasmtime::component::ComponentExportIndex, 531 r7: wasmtime::component::ComponentExportIndex, 532 r8: wasmtime::component::ComponentExportIndex, 533 pair_ret: wasmtime::component::ComponentExportIndex, 534 } 535 impl GuestIndices { 536 /// Constructor for [`GuestIndices`] which takes a 537 /// [`Component`](wasmtime::component::Component) as input and can be executed 538 /// before instantiation. 539 /// 540 /// This constructor can be used to front-load string lookups to find exports 541 /// within a component. 542 pub fn new<_T>( 543 _instance_pre: &wasmtime::component::InstancePre<_T>, 544 ) -> wasmtime::Result<GuestIndices> { 545 let instance = _instance_pre 546 .component() 547 .get_export_index(None, "foo:foo/integers") 548 .ok_or_else(|| { 549 wasmtime::format_err!( 550 "no exported instance named `foo:foo/integers`" 551 ) 552 })?; 553 let mut lookup = move |name| { 554 _instance_pre 555 .component() 556 .get_export_index(Some(&instance), name) 557 .ok_or_else(|| { 558 wasmtime::format_err!( 559 "instance export `foo:foo/integers` does \ 560 not have export `{name}`" 561 ) 562 }) 563 }; 564 let _ = &mut lookup; 565 let a1 = lookup("a1")?; 566 let a2 = lookup("a2")?; 567 let a3 = lookup("a3")?; 568 let a4 = lookup("a4")?; 569 let a5 = lookup("a5")?; 570 let a6 = lookup("a6")?; 571 let a7 = lookup("a7")?; 572 let a8 = lookup("a8")?; 573 let a9 = lookup("a9")?; 574 let r1 = lookup("r1")?; 575 let r2 = lookup("r2")?; 576 let r3 = lookup("r3")?; 577 let r4 = lookup("r4")?; 578 let r5 = lookup("r5")?; 579 let r6 = lookup("r6")?; 580 let r7 = lookup("r7")?; 581 let r8 = lookup("r8")?; 582 let pair_ret = lookup("pair-ret")?; 583 Ok(GuestIndices { 584 a1, 585 a2, 586 a3, 587 a4, 588 a5, 589 a6, 590 a7, 591 a8, 592 a9, 593 r1, 594 r2, 595 r3, 596 r4, 597 r5, 598 r6, 599 r7, 600 r8, 601 pair_ret, 602 }) 603 } 604 pub fn load( 605 &self, 606 mut store: impl wasmtime::AsContextMut, 607 instance: &wasmtime::component::Instance, 608 ) -> wasmtime::Result<Guest> { 609 let _instance = instance; 610 let _instance_pre = _instance.instance_pre(&store); 611 let _instance_type = _instance_pre.instance_type(); 612 let mut store = store.as_context_mut(); 613 let _ = &mut store; 614 let a1 = *_instance 615 .get_typed_func::<(u8,), ()>(&mut store, &self.a1)? 616 .func(); 617 let a2 = *_instance 618 .get_typed_func::<(i8,), ()>(&mut store, &self.a2)? 619 .func(); 620 let a3 = *_instance 621 .get_typed_func::<(u16,), ()>(&mut store, &self.a3)? 622 .func(); 623 let a4 = *_instance 624 .get_typed_func::<(i16,), ()>(&mut store, &self.a4)? 625 .func(); 626 let a5 = *_instance 627 .get_typed_func::<(u32,), ()>(&mut store, &self.a5)? 628 .func(); 629 let a6 = *_instance 630 .get_typed_func::<(i32,), ()>(&mut store, &self.a6)? 631 .func(); 632 let a7 = *_instance 633 .get_typed_func::<(u64,), ()>(&mut store, &self.a7)? 634 .func(); 635 let a8 = *_instance 636 .get_typed_func::<(i64,), ()>(&mut store, &self.a8)? 637 .func(); 638 let a9 = *_instance 639 .get_typed_func::< 640 (u8, i8, u16, i16, u32, i32, u64, i64), 641 (), 642 >(&mut store, &self.a9)? 643 .func(); 644 let r1 = *_instance 645 .get_typed_func::<(), (u8,)>(&mut store, &self.r1)? 646 .func(); 647 let r2 = *_instance 648 .get_typed_func::<(), (i8,)>(&mut store, &self.r2)? 649 .func(); 650 let r3 = *_instance 651 .get_typed_func::<(), (u16,)>(&mut store, &self.r3)? 652 .func(); 653 let r4 = *_instance 654 .get_typed_func::<(), (i16,)>(&mut store, &self.r4)? 655 .func(); 656 let r5 = *_instance 657 .get_typed_func::<(), (u32,)>(&mut store, &self.r5)? 658 .func(); 659 let r6 = *_instance 660 .get_typed_func::<(), (i32,)>(&mut store, &self.r6)? 661 .func(); 662 let r7 = *_instance 663 .get_typed_func::<(), (u64,)>(&mut store, &self.r7)? 664 .func(); 665 let r8 = *_instance 666 .get_typed_func::<(), (i64,)>(&mut store, &self.r8)? 667 .func(); 668 let pair_ret = *_instance 669 .get_typed_func::< 670 (), 671 ((i64, u8),), 672 >(&mut store, &self.pair_ret)? 673 .func(); 674 Ok(Guest { 675 a1, 676 a2, 677 a3, 678 a4, 679 a5, 680 a6, 681 a7, 682 a8, 683 a9, 684 r1, 685 r2, 686 r3, 687 r4, 688 r5, 689 r6, 690 r7, 691 r8, 692 pair_ret, 693 }) 694 } 695 } 696 impl Guest { 697 pub async fn call_a1<_T, _D>( 698 &self, 699 accessor: &wasmtime::component::Accessor<_T, _D>, 700 arg0: u8, 701 ) -> wasmtime::Result<()> 702 where 703 _T: Send, 704 _D: wasmtime::component::HasData, 705 { 706 let callee = unsafe { 707 wasmtime::component::TypedFunc::< 708 (u8,), 709 (), 710 >::new_unchecked(self.a1) 711 }; 712 let ((), _) = callee.call_concurrent(accessor, (arg0,)).await?; 713 Ok(()) 714 } 715 pub async fn call_a2<_T, _D>( 716 &self, 717 accessor: &wasmtime::component::Accessor<_T, _D>, 718 arg0: i8, 719 ) -> wasmtime::Result<()> 720 where 721 _T: Send, 722 _D: wasmtime::component::HasData, 723 { 724 let callee = unsafe { 725 wasmtime::component::TypedFunc::< 726 (i8,), 727 (), 728 >::new_unchecked(self.a2) 729 }; 730 let ((), _) = callee.call_concurrent(accessor, (arg0,)).await?; 731 Ok(()) 732 } 733 pub async fn call_a3<_T, _D>( 734 &self, 735 accessor: &wasmtime::component::Accessor<_T, _D>, 736 arg0: u16, 737 ) -> wasmtime::Result<()> 738 where 739 _T: Send, 740 _D: wasmtime::component::HasData, 741 { 742 let callee = unsafe { 743 wasmtime::component::TypedFunc::< 744 (u16,), 745 (), 746 >::new_unchecked(self.a3) 747 }; 748 let ((), _) = callee.call_concurrent(accessor, (arg0,)).await?; 749 Ok(()) 750 } 751 pub async fn call_a4<_T, _D>( 752 &self, 753 accessor: &wasmtime::component::Accessor<_T, _D>, 754 arg0: i16, 755 ) -> wasmtime::Result<()> 756 where 757 _T: Send, 758 _D: wasmtime::component::HasData, 759 { 760 let callee = unsafe { 761 wasmtime::component::TypedFunc::< 762 (i16,), 763 (), 764 >::new_unchecked(self.a4) 765 }; 766 let ((), _) = callee.call_concurrent(accessor, (arg0,)).await?; 767 Ok(()) 768 } 769 pub async fn call_a5<_T, _D>( 770 &self, 771 accessor: &wasmtime::component::Accessor<_T, _D>, 772 arg0: u32, 773 ) -> wasmtime::Result<()> 774 where 775 _T: Send, 776 _D: wasmtime::component::HasData, 777 { 778 let callee = unsafe { 779 wasmtime::component::TypedFunc::< 780 (u32,), 781 (), 782 >::new_unchecked(self.a5) 783 }; 784 let ((), _) = callee.call_concurrent(accessor, (arg0,)).await?; 785 Ok(()) 786 } 787 pub async fn call_a6<_T, _D>( 788 &self, 789 accessor: &wasmtime::component::Accessor<_T, _D>, 790 arg0: i32, 791 ) -> wasmtime::Result<()> 792 where 793 _T: Send, 794 _D: wasmtime::component::HasData, 795 { 796 let callee = unsafe { 797 wasmtime::component::TypedFunc::< 798 (i32,), 799 (), 800 >::new_unchecked(self.a6) 801 }; 802 let ((), _) = callee.call_concurrent(accessor, (arg0,)).await?; 803 Ok(()) 804 } 805 pub async fn call_a7<_T, _D>( 806 &self, 807 accessor: &wasmtime::component::Accessor<_T, _D>, 808 arg0: u64, 809 ) -> wasmtime::Result<()> 810 where 811 _T: Send, 812 _D: wasmtime::component::HasData, 813 { 814 let callee = unsafe { 815 wasmtime::component::TypedFunc::< 816 (u64,), 817 (), 818 >::new_unchecked(self.a7) 819 }; 820 let ((), _) = callee.call_concurrent(accessor, (arg0,)).await?; 821 Ok(()) 822 } 823 pub async fn call_a8<_T, _D>( 824 &self, 825 accessor: &wasmtime::component::Accessor<_T, _D>, 826 arg0: i64, 827 ) -> wasmtime::Result<()> 828 where 829 _T: Send, 830 _D: wasmtime::component::HasData, 831 { 832 let callee = unsafe { 833 wasmtime::component::TypedFunc::< 834 (i64,), 835 (), 836 >::new_unchecked(self.a8) 837 }; 838 let ((), _) = callee.call_concurrent(accessor, (arg0,)).await?; 839 Ok(()) 840 } 841 pub async fn call_a9<_T, _D>( 842 &self, 843 accessor: &wasmtime::component::Accessor<_T, _D>, 844 arg0: u8, 845 arg1: i8, 846 arg2: u16, 847 arg3: i16, 848 arg4: u32, 849 arg5: i32, 850 arg6: u64, 851 arg7: i64, 852 ) -> wasmtime::Result<()> 853 where 854 _T: Send, 855 _D: wasmtime::component::HasData, 856 { 857 let callee = unsafe { 858 wasmtime::component::TypedFunc::< 859 (u8, i8, u16, i16, u32, i32, u64, i64), 860 (), 861 >::new_unchecked(self.a9) 862 }; 863 let ((), _) = callee 864 .call_concurrent( 865 accessor, 866 (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7), 867 ) 868 .await?; 869 Ok(()) 870 } 871 pub async fn call_r1<_T, _D>( 872 &self, 873 accessor: &wasmtime::component::Accessor<_T, _D>, 874 ) -> wasmtime::Result<u8> 875 where 876 _T: Send, 877 _D: wasmtime::component::HasData, 878 { 879 let callee = unsafe { 880 wasmtime::component::TypedFunc::< 881 (), 882 (u8,), 883 >::new_unchecked(self.r1) 884 }; 885 let ((ret0,), _) = callee.call_concurrent(accessor, ()).await?; 886 Ok(ret0) 887 } 888 pub async fn call_r2<_T, _D>( 889 &self, 890 accessor: &wasmtime::component::Accessor<_T, _D>, 891 ) -> wasmtime::Result<i8> 892 where 893 _T: Send, 894 _D: wasmtime::component::HasData, 895 { 896 let callee = unsafe { 897 wasmtime::component::TypedFunc::< 898 (), 899 (i8,), 900 >::new_unchecked(self.r2) 901 }; 902 let ((ret0,), _) = callee.call_concurrent(accessor, ()).await?; 903 Ok(ret0) 904 } 905 pub async fn call_r3<_T, _D>( 906 &self, 907 accessor: &wasmtime::component::Accessor<_T, _D>, 908 ) -> wasmtime::Result<u16> 909 where 910 _T: Send, 911 _D: wasmtime::component::HasData, 912 { 913 let callee = unsafe { 914 wasmtime::component::TypedFunc::< 915 (), 916 (u16,), 917 >::new_unchecked(self.r3) 918 }; 919 let ((ret0,), _) = callee.call_concurrent(accessor, ()).await?; 920 Ok(ret0) 921 } 922 pub async fn call_r4<_T, _D>( 923 &self, 924 accessor: &wasmtime::component::Accessor<_T, _D>, 925 ) -> wasmtime::Result<i16> 926 where 927 _T: Send, 928 _D: wasmtime::component::HasData, 929 { 930 let callee = unsafe { 931 wasmtime::component::TypedFunc::< 932 (), 933 (i16,), 934 >::new_unchecked(self.r4) 935 }; 936 let ((ret0,), _) = callee.call_concurrent(accessor, ()).await?; 937 Ok(ret0) 938 } 939 pub async fn call_r5<_T, _D>( 940 &self, 941 accessor: &wasmtime::component::Accessor<_T, _D>, 942 ) -> wasmtime::Result<u32> 943 where 944 _T: Send, 945 _D: wasmtime::component::HasData, 946 { 947 let callee = unsafe { 948 wasmtime::component::TypedFunc::< 949 (), 950 (u32,), 951 >::new_unchecked(self.r5) 952 }; 953 let ((ret0,), _) = callee.call_concurrent(accessor, ()).await?; 954 Ok(ret0) 955 } 956 pub async fn call_r6<_T, _D>( 957 &self, 958 accessor: &wasmtime::component::Accessor<_T, _D>, 959 ) -> wasmtime::Result<i32> 960 where 961 _T: Send, 962 _D: wasmtime::component::HasData, 963 { 964 let callee = unsafe { 965 wasmtime::component::TypedFunc::< 966 (), 967 (i32,), 968 >::new_unchecked(self.r6) 969 }; 970 let ((ret0,), _) = callee.call_concurrent(accessor, ()).await?; 971 Ok(ret0) 972 } 973 pub async fn call_r7<_T, _D>( 974 &self, 975 accessor: &wasmtime::component::Accessor<_T, _D>, 976 ) -> wasmtime::Result<u64> 977 where 978 _T: Send, 979 _D: wasmtime::component::HasData, 980 { 981 let callee = unsafe { 982 wasmtime::component::TypedFunc::< 983 (), 984 (u64,), 985 >::new_unchecked(self.r7) 986 }; 987 let ((ret0,), _) = callee.call_concurrent(accessor, ()).await?; 988 Ok(ret0) 989 } 990 pub async fn call_r8<_T, _D>( 991 &self, 992 accessor: &wasmtime::component::Accessor<_T, _D>, 993 ) -> wasmtime::Result<i64> 994 where 995 _T: Send, 996 _D: wasmtime::component::HasData, 997 { 998 let callee = unsafe { 999 wasmtime::component::TypedFunc::< 1000 (), 1001 (i64,), 1002 >::new_unchecked(self.r8) 1003 }; 1004 let ((ret0,), _) = callee.call_concurrent(accessor, ()).await?; 1005 Ok(ret0) 1006 } 1007 pub async fn call_pair_ret<_T, _D>( 1008 &self, 1009 accessor: &wasmtime::component::Accessor<_T, _D>, 1010 ) -> wasmtime::Result<(i64, u8)> 1011 where 1012 _T: Send, 1013 _D: wasmtime::component::HasData, 1014 { 1015 let callee = unsafe { 1016 wasmtime::component::TypedFunc::< 1017 (), 1018 ((i64, u8),), 1019 >::new_unchecked(self.pair_ret) 1020 }; 1021 let ((ret0,), _) = callee.call_concurrent(accessor, ()).await?; 1022 Ok(ret0) 1023 } 1024 } 1025 } 1026 } 1027 } 1028 } 1029