1636435f1SJoel Dice /// Auto-generated bindings for a pre-instantiated version of a 2636435f1SJoel Dice /// component which implements the world `the-world`. 3636435f1SJoel Dice /// 4636435f1SJoel Dice /// This structure is created through [`TheWorldPre::new`] which 5636435f1SJoel Dice /// takes a [`InstancePre`](wasmtime::component::InstancePre) that 6636435f1SJoel Dice /// has been created through a [`Linker`](wasmtime::component::Linker). 7636435f1SJoel Dice /// 8636435f1SJoel Dice /// For more information see [`TheWorld`] as well. 9f81c0dc0SAlex Crichton pub struct TheWorldPre<T: 'static> { 10636435f1SJoel Dice instance_pre: wasmtime::component::InstancePre<T>, 11636435f1SJoel Dice indices: TheWorldIndices, 12636435f1SJoel Dice } 13f81c0dc0SAlex Crichton impl<T: 'static> Clone for TheWorldPre<T> { clone(&self) -> Self14636435f1SJoel Dice fn clone(&self) -> Self { 15636435f1SJoel Dice Self { 16636435f1SJoel Dice instance_pre: self.instance_pre.clone(), 17636435f1SJoel Dice indices: self.indices.clone(), 18636435f1SJoel Dice } 19636435f1SJoel Dice } 20636435f1SJoel Dice } 21f81c0dc0SAlex Crichton impl<_T: 'static> TheWorldPre<_T> { 22636435f1SJoel Dice /// Creates a new copy of `TheWorldPre` bindings which can then 23636435f1SJoel Dice /// be used to instantiate into a particular store. 24636435f1SJoel Dice /// 25636435f1SJoel Dice /// This method may fail if the component behind `instance_pre` 26636435f1SJoel Dice /// does not have the required exports. new( instance_pre: wasmtime::component::InstancePre<_T>, ) -> wasmtime::Result<Self>27636435f1SJoel Dice pub fn new( 28636435f1SJoel Dice instance_pre: wasmtime::component::InstancePre<_T>, 29636435f1SJoel Dice ) -> wasmtime::Result<Self> { 30bb77f602SPat Hickey let indices = TheWorldIndices::new(&instance_pre)?; 31636435f1SJoel Dice Ok(Self { instance_pre, indices }) 32636435f1SJoel Dice } engine(&self) -> &wasmtime::Engine33636435f1SJoel Dice pub fn engine(&self) -> &wasmtime::Engine { 34636435f1SJoel Dice self.instance_pre.engine() 35636435f1SJoel Dice } instance_pre(&self) -> &wasmtime::component::InstancePre<_T>36636435f1SJoel Dice pub fn instance_pre(&self) -> &wasmtime::component::InstancePre<_T> { 37636435f1SJoel Dice &self.instance_pre 38636435f1SJoel Dice } 39636435f1SJoel Dice /// Instantiates a new instance of [`TheWorld`] within the 40636435f1SJoel Dice /// `store` provided. 41636435f1SJoel Dice /// 42636435f1SJoel Dice /// This function will use `self` as the pre-instantiated 43636435f1SJoel Dice /// instance to perform instantiation. Afterwards the preloaded 44636435f1SJoel Dice /// indices in `self` are used to lookup all exports on the 45636435f1SJoel Dice /// resulting instance. instantiate( &self, mut store: impl wasmtime::AsContextMut<Data = _T>, ) -> wasmtime::Result<TheWorld>461155d6dfSAlex Crichton pub fn instantiate( 471155d6dfSAlex Crichton &self, 481155d6dfSAlex Crichton mut store: impl wasmtime::AsContextMut<Data = _T>, 491155d6dfSAlex Crichton ) -> wasmtime::Result<TheWorld> { 501155d6dfSAlex Crichton let mut store = store.as_context_mut(); 511155d6dfSAlex Crichton let instance = self.instance_pre.instantiate(&mut store)?; 521155d6dfSAlex Crichton self.indices.load(&mut store, &instance) 531155d6dfSAlex Crichton } 541155d6dfSAlex Crichton } 551155d6dfSAlex Crichton impl<_T: Send + 'static> TheWorldPre<_T> { 561155d6dfSAlex Crichton /// Same as [`Self::instantiate`], except with `async`. instantiate_async( &self, mut store: impl wasmtime::AsContextMut<Data = _T>, ) -> wasmtime::Result<TheWorld>57636435f1SJoel Dice pub async fn instantiate_async( 58636435f1SJoel Dice &self, 59636435f1SJoel Dice mut store: impl wasmtime::AsContextMut<Data = _T>, 601155d6dfSAlex Crichton ) -> wasmtime::Result<TheWorld> { 61636435f1SJoel Dice let mut store = store.as_context_mut(); 62636435f1SJoel Dice let instance = self.instance_pre.instantiate_async(&mut store).await?; 63636435f1SJoel Dice self.indices.load(&mut store, &instance) 64636435f1SJoel Dice } 65636435f1SJoel Dice } 66636435f1SJoel Dice /// Auto-generated bindings for index of the exports of 67636435f1SJoel Dice /// `the-world`. 68636435f1SJoel Dice /// 69636435f1SJoel Dice /// This is an implementation detail of [`TheWorldPre`] and can 70636435f1SJoel Dice /// be constructed if needed as well. 71636435f1SJoel Dice /// 72636435f1SJoel Dice /// For more information see [`TheWorld`] as well. 73636435f1SJoel Dice #[derive(Clone)] 74636435f1SJoel Dice pub struct TheWorldIndices { 75636435f1SJoel Dice interface0: exports::foo::foo::strings::GuestIndices, 76636435f1SJoel Dice } 77636435f1SJoel Dice /// Auto-generated bindings for an instance a component which 78636435f1SJoel Dice /// implements the world `the-world`. 79636435f1SJoel Dice /// 80636435f1SJoel Dice /// This structure can be created through a number of means 81636435f1SJoel Dice /// depending on your requirements and what you have on hand: 82636435f1SJoel Dice /// 83636435f1SJoel Dice /// * The most convenient way is to use 841155d6dfSAlex Crichton /// [`TheWorld::instantiate`] which only needs a 85636435f1SJoel Dice /// [`Store`], [`Component`], and [`Linker`]. 86636435f1SJoel Dice /// 87636435f1SJoel Dice /// * Alternatively you can create a [`TheWorldPre`] ahead of 88636435f1SJoel Dice /// time with a [`Component`] to front-load string lookups 89636435f1SJoel Dice /// of exports once instead of per-instantiation. This 901155d6dfSAlex Crichton /// method then uses [`TheWorldPre::instantiate`] to 91636435f1SJoel Dice /// create a [`TheWorld`]. 92636435f1SJoel Dice /// 93636435f1SJoel Dice /// * If you've instantiated the instance yourself already 94636435f1SJoel Dice /// then you can use [`TheWorld::new`]. 95636435f1SJoel Dice /// 96636435f1SJoel Dice /// These methods are all equivalent to one another and move 97636435f1SJoel Dice /// around the tradeoff of what work is performed when. 98636435f1SJoel Dice /// 99636435f1SJoel Dice /// [`Store`]: wasmtime::Store 100636435f1SJoel Dice /// [`Component`]: wasmtime::component::Component 101636435f1SJoel Dice /// [`Linker`]: wasmtime::component::Linker 102636435f1SJoel Dice pub struct TheWorld { 103636435f1SJoel Dice interface0: exports::foo::foo::strings::Guest, 104636435f1SJoel Dice } 105636435f1SJoel Dice const _: () = { 106636435f1SJoel Dice impl TheWorldIndices { 107636435f1SJoel Dice /// Creates a new copy of `TheWorldIndices` bindings which can then 108636435f1SJoel Dice /// be used to instantiate into a particular store. 109636435f1SJoel Dice /// 110636435f1SJoel Dice /// This method may fail if the component does not have the 111636435f1SJoel Dice /// required exports. new<_T>( _instance_pre: &wasmtime::component::InstancePre<_T>, ) -> wasmtime::Result<Self>112bb77f602SPat Hickey pub fn new<_T>( 113bb77f602SPat Hickey _instance_pre: &wasmtime::component::InstancePre<_T>, 114636435f1SJoel Dice ) -> wasmtime::Result<Self> { 115bb77f602SPat Hickey let _component = _instance_pre.component(); 116bb77f602SPat Hickey let _instance_type = _instance_pre.instance_type(); 117bb77f602SPat Hickey let interface0 = exports::foo::foo::strings::GuestIndices::new( 118bb77f602SPat Hickey _instance_pre, 119636435f1SJoel Dice )?; 120636435f1SJoel Dice Ok(TheWorldIndices { interface0 }) 121636435f1SJoel Dice } 122636435f1SJoel Dice /// Uses the indices stored in `self` to load an instance 123636435f1SJoel Dice /// of [`TheWorld`] from the instance provided. 124636435f1SJoel Dice /// 125636435f1SJoel Dice /// Note that at this time this method will additionally 126636435f1SJoel Dice /// perform type-checks of all exports. load( &self, mut store: impl wasmtime::AsContextMut, instance: &wasmtime::component::Instance, ) -> wasmtime::Result<TheWorld>127636435f1SJoel Dice pub fn load( 128636435f1SJoel Dice &self, 129636435f1SJoel Dice mut store: impl wasmtime::AsContextMut, 130636435f1SJoel Dice instance: &wasmtime::component::Instance, 131636435f1SJoel Dice ) -> wasmtime::Result<TheWorld> { 132bb77f602SPat Hickey let _ = &mut store; 133636435f1SJoel Dice let _instance = instance; 134636435f1SJoel Dice let interface0 = self.interface0.load(&mut store, &_instance)?; 135636435f1SJoel Dice Ok(TheWorld { interface0 }) 136636435f1SJoel Dice } 137636435f1SJoel Dice } 138636435f1SJoel Dice impl TheWorld { 139636435f1SJoel Dice /// Convenience wrapper around [`TheWorldPre::new`] and 1401155d6dfSAlex Crichton /// [`TheWorldPre::instantiate`]. instantiate<_T>( store: impl wasmtime::AsContextMut<Data = _T>, component: &wasmtime::component::Component, linker: &wasmtime::component::Linker<_T>, ) -> wasmtime::Result<TheWorld>1411155d6dfSAlex Crichton pub fn instantiate<_T>( 1421155d6dfSAlex Crichton store: impl wasmtime::AsContextMut<Data = _T>, 1431155d6dfSAlex Crichton component: &wasmtime::component::Component, 1441155d6dfSAlex Crichton linker: &wasmtime::component::Linker<_T>, 1451155d6dfSAlex Crichton ) -> wasmtime::Result<TheWorld> { 1461155d6dfSAlex Crichton let pre = linker.instantiate_pre(component)?; 1471155d6dfSAlex Crichton TheWorldPre::new(pre)?.instantiate(store) 1481155d6dfSAlex Crichton } 1491155d6dfSAlex Crichton /// Convenience wrapper around [`TheWorldIndices::new`] and 1501155d6dfSAlex Crichton /// [`TheWorldIndices::load`]. new( mut store: impl wasmtime::AsContextMut, instance: &wasmtime::component::Instance, ) -> wasmtime::Result<TheWorld>1511155d6dfSAlex Crichton pub fn new( 1521155d6dfSAlex Crichton mut store: impl wasmtime::AsContextMut, 1531155d6dfSAlex Crichton instance: &wasmtime::component::Instance, 1541155d6dfSAlex Crichton ) -> wasmtime::Result<TheWorld> { 1551155d6dfSAlex Crichton let indices = TheWorldIndices::new(&instance.instance_pre(&store))?; 1561155d6dfSAlex Crichton indices.load(&mut store, instance) 1571155d6dfSAlex Crichton } 1581155d6dfSAlex Crichton /// Convenience wrapper around [`TheWorldPre::new`] and 159636435f1SJoel Dice /// [`TheWorldPre::instantiate_async`]. instantiate_async<_T>( store: impl wasmtime::AsContextMut<Data = _T>, component: &wasmtime::component::Component, linker: &wasmtime::component::Linker<_T>, ) -> wasmtime::Result<TheWorld> where _T: Send,160636435f1SJoel Dice pub async fn instantiate_async<_T>( 161bb77f602SPat Hickey store: impl wasmtime::AsContextMut<Data = _T>, 162636435f1SJoel Dice component: &wasmtime::component::Component, 163636435f1SJoel Dice linker: &wasmtime::component::Linker<_T>, 164636435f1SJoel Dice ) -> wasmtime::Result<TheWorld> 165636435f1SJoel Dice where 166beca86b0SAlex Crichton _T: Send, 167636435f1SJoel Dice { 168636435f1SJoel Dice let pre = linker.instantiate_pre(component)?; 169636435f1SJoel Dice TheWorldPre::new(pre)?.instantiate_async(store).await 170636435f1SJoel Dice } add_to_linker<T, D>( linker: &mut wasmtime::component::Linker<T>, host_getter: fn(&mut T) -> D::Data<'_>, ) -> wasmtime::Result<()> where D: foo::foo::strings::HostWithStore + Send, for<'a> D::Data<'a>: foo::foo::strings::Host + Send, T: 'static + Send,171beca86b0SAlex Crichton pub fn add_to_linker<T, D>( 172636435f1SJoel Dice linker: &mut wasmtime::component::Linker<T>, 173beca86b0SAlex Crichton host_getter: fn(&mut T) -> D::Data<'_>, 174636435f1SJoel Dice ) -> wasmtime::Result<()> 175636435f1SJoel Dice where 1761155d6dfSAlex Crichton D: foo::foo::strings::HostWithStore + Send, 177beca86b0SAlex Crichton for<'a> D::Data<'a>: foo::foo::strings::Host + Send, 178beca86b0SAlex Crichton T: 'static + Send, 179636435f1SJoel Dice { 180beca86b0SAlex Crichton foo::foo::strings::add_to_linker::<T, D>(linker, host_getter)?; 181636435f1SJoel Dice Ok(()) 182636435f1SJoel Dice } foo_foo_strings(&self) -> &exports::foo::foo::strings::Guest183636435f1SJoel Dice pub fn foo_foo_strings(&self) -> &exports::foo::foo::strings::Guest { 184636435f1SJoel Dice &self.interface0 185636435f1SJoel Dice } 186636435f1SJoel Dice } 187636435f1SJoel Dice }; 188636435f1SJoel Dice pub mod foo { 189636435f1SJoel Dice pub mod foo { 190636435f1SJoel Dice #[allow(clippy::all)] 191636435f1SJoel Dice pub mod strings { 192636435f1SJoel Dice #[allow(unused_imports)] 19396e19700SNick Fitzgerald use wasmtime::component::__internal::Box; 1941155d6dfSAlex Crichton pub trait HostWithStore: wasmtime::component::HasData + Send { a<T: Send>( accessor: &wasmtime::component::Accessor<T, Self>, x: wasmtime::component::__internal::String, ) -> impl ::core::future::Future<Output = ()> + Send195b856261dSJoel Dice fn a<T: Send>( 19664bc3bd9SAlex Crichton accessor: &wasmtime::component::Accessor<T, Self>, 197636435f1SJoel Dice x: wasmtime::component::__internal::String, 1981155d6dfSAlex Crichton ) -> impl ::core::future::Future<Output = ()> + Send; b<T: Send>( accessor: &wasmtime::component::Accessor<T, Self>, ) -> impl ::core::future::Future< Output = wasmtime::component::__internal::String, > + Send199b856261dSJoel Dice fn b<T: Send>( 20064bc3bd9SAlex Crichton accessor: &wasmtime::component::Accessor<T, Self>, 201f063003eSPat Hickey ) -> impl ::core::future::Future< 202beca86b0SAlex Crichton Output = wasmtime::component::__internal::String, 2031155d6dfSAlex Crichton > + Send; c<T: Send>( accessor: &wasmtime::component::Accessor<T, Self>, a: wasmtime::component::__internal::String, b: wasmtime::component::__internal::String, ) -> impl ::core::future::Future< Output = wasmtime::component::__internal::String, > + Send204b856261dSJoel Dice fn c<T: Send>( 20564bc3bd9SAlex Crichton accessor: &wasmtime::component::Accessor<T, Self>, 206636435f1SJoel Dice a: wasmtime::component::__internal::String, 207636435f1SJoel Dice b: wasmtime::component::__internal::String, 208f063003eSPat Hickey ) -> impl ::core::future::Future< 209beca86b0SAlex Crichton Output = wasmtime::component::__internal::String, 2101155d6dfSAlex Crichton > + Send; 211636435f1SJoel Dice } 212beca86b0SAlex Crichton pub trait Host: Send {} 213beca86b0SAlex Crichton impl<_T: Host + ?Sized + Send> Host for &mut _T {} add_to_linker<T, D>( linker: &mut wasmtime::component::Linker<T>, host_getter: fn(&mut T) -> D::Data<'_>, ) -> wasmtime::Result<()> where D: HostWithStore, for<'a> D::Data<'a>: Host, T: 'static + Send,214beca86b0SAlex Crichton pub fn add_to_linker<T, D>( 215636435f1SJoel Dice linker: &mut wasmtime::component::Linker<T>, 216beca86b0SAlex Crichton host_getter: fn(&mut T) -> D::Data<'_>, 217636435f1SJoel Dice ) -> wasmtime::Result<()> 218636435f1SJoel Dice where 2191155d6dfSAlex Crichton D: HostWithStore, 220beca86b0SAlex Crichton for<'a> D::Data<'a>: Host, 221beca86b0SAlex Crichton T: 'static + Send, 222636435f1SJoel Dice { 223636435f1SJoel Dice let mut inst = linker.instance("foo:foo/strings")?; 224636435f1SJoel Dice inst.func_wrap_concurrent( 225636435f1SJoel Dice "a", 226636435f1SJoel Dice move | 22764bc3bd9SAlex Crichton caller: &wasmtime::component::Accessor<T>, 228636435f1SJoel Dice (arg0,): (wasmtime::component::__internal::String,)| 229636435f1SJoel Dice { 230beca86b0SAlex Crichton wasmtime::component::__internal::Box::pin(async move { 2319f47be2eSAlex Crichton let host = &caller.with_getter(host_getter); 2329f47be2eSAlex Crichton let r = <D as HostWithStore>::a(host, arg0).await; 233636435f1SJoel Dice Ok(r) 234636435f1SJoel Dice }) 235636435f1SJoel Dice }, 236636435f1SJoel Dice )?; 237636435f1SJoel Dice inst.func_wrap_concurrent( 238636435f1SJoel Dice "b", 23964bc3bd9SAlex Crichton move |caller: &wasmtime::component::Accessor<T>, (): ()| { 240beca86b0SAlex Crichton wasmtime::component::__internal::Box::pin(async move { 2419f47be2eSAlex Crichton let host = &caller.with_getter(host_getter); 2429f47be2eSAlex Crichton let r = <D as HostWithStore>::b(host).await; 243636435f1SJoel Dice Ok((r,)) 244636435f1SJoel Dice }) 245636435f1SJoel Dice }, 246636435f1SJoel Dice )?; 247636435f1SJoel Dice inst.func_wrap_concurrent( 248636435f1SJoel Dice "c", 249636435f1SJoel Dice move | 25064bc3bd9SAlex Crichton caller: &wasmtime::component::Accessor<T>, 251636435f1SJoel Dice ( 252636435f1SJoel Dice arg0, 253636435f1SJoel Dice arg1, 254636435f1SJoel Dice ): ( 255636435f1SJoel Dice wasmtime::component::__internal::String, 256636435f1SJoel Dice wasmtime::component::__internal::String, 257636435f1SJoel Dice )| 258636435f1SJoel Dice { 259beca86b0SAlex Crichton wasmtime::component::__internal::Box::pin(async move { 2609f47be2eSAlex Crichton let host = &caller.with_getter(host_getter); 2619f47be2eSAlex Crichton let r = <D as HostWithStore>::c(host, arg0, arg1).await; 262636435f1SJoel Dice Ok((r,)) 263636435f1SJoel Dice }) 264636435f1SJoel Dice }, 265636435f1SJoel Dice )?; 266636435f1SJoel Dice Ok(()) 267636435f1SJoel Dice } 268636435f1SJoel Dice } 269636435f1SJoel Dice } 270636435f1SJoel Dice } 271636435f1SJoel Dice pub mod exports { 272636435f1SJoel Dice pub mod foo { 273636435f1SJoel Dice pub mod foo { 274636435f1SJoel Dice #[allow(clippy::all)] 275636435f1SJoel Dice pub mod strings { 276636435f1SJoel Dice #[allow(unused_imports)] 27796e19700SNick Fitzgerald use wasmtime::component::__internal::Box; 278fee9be21SAlex Crichton #[derive(Clone)] 279636435f1SJoel Dice pub struct Guest { 280636435f1SJoel Dice a: wasmtime::component::Func, 281636435f1SJoel Dice b: wasmtime::component::Func, 282636435f1SJoel Dice c: wasmtime::component::Func, 283636435f1SJoel Dice } 284636435f1SJoel Dice #[derive(Clone)] 285636435f1SJoel Dice pub struct GuestIndices { 286636435f1SJoel Dice a: wasmtime::component::ComponentExportIndex, 287636435f1SJoel Dice b: wasmtime::component::ComponentExportIndex, 288636435f1SJoel Dice c: wasmtime::component::ComponentExportIndex, 289636435f1SJoel Dice } 290636435f1SJoel Dice impl GuestIndices { 291636435f1SJoel Dice /// Constructor for [`GuestIndices`] which takes a 292636435f1SJoel Dice /// [`Component`](wasmtime::component::Component) as input and can be executed 293636435f1SJoel Dice /// before instantiation. 294636435f1SJoel Dice /// 295636435f1SJoel Dice /// This constructor can be used to front-load string lookups to find exports 296636435f1SJoel Dice /// within a component. new<_T>( _instance_pre: &wasmtime::component::InstancePre<_T>, ) -> wasmtime::Result<GuestIndices>297bb77f602SPat Hickey pub fn new<_T>( 298bb77f602SPat Hickey _instance_pre: &wasmtime::component::InstancePre<_T>, 299636435f1SJoel Dice ) -> wasmtime::Result<GuestIndices> { 300bb77f602SPat Hickey let instance = _instance_pre 301bb77f602SPat Hickey .component() 30295cc0297SPat Hickey .get_export_index(None, "foo:foo/strings") 303636435f1SJoel Dice .ok_or_else(|| { 30496e19700SNick Fitzgerald wasmtime::format_err!( 305636435f1SJoel Dice "no exported instance named `foo:foo/strings`" 306636435f1SJoel Dice ) 307636435f1SJoel Dice })?; 308636435f1SJoel Dice let mut lookup = move |name| { 309bb77f602SPat Hickey _instance_pre 310bb77f602SPat Hickey .component() 311bb77f602SPat Hickey .get_export_index(Some(&instance), name) 312636435f1SJoel Dice .ok_or_else(|| { 31396e19700SNick Fitzgerald wasmtime::format_err!( 314636435f1SJoel Dice "instance export `foo:foo/strings` does \ 315636435f1SJoel Dice not have export `{name}`" 316636435f1SJoel Dice ) 317636435f1SJoel Dice }) 318636435f1SJoel Dice }; 319636435f1SJoel Dice let _ = &mut lookup; 320636435f1SJoel Dice let a = lookup("a")?; 321636435f1SJoel Dice let b = lookup("b")?; 322636435f1SJoel Dice let c = lookup("c")?; 323636435f1SJoel Dice Ok(GuestIndices { a, b, c }) 324636435f1SJoel Dice } load( &self, mut store: impl wasmtime::AsContextMut, instance: &wasmtime::component::Instance, ) -> wasmtime::Result<Guest>325636435f1SJoel Dice pub fn load( 326636435f1SJoel Dice &self, 327636435f1SJoel Dice mut store: impl wasmtime::AsContextMut, 328636435f1SJoel Dice instance: &wasmtime::component::Instance, 329636435f1SJoel Dice ) -> wasmtime::Result<Guest> { 330bb77f602SPat Hickey let _instance = instance; 331bb77f602SPat Hickey let _instance_pre = _instance.instance_pre(&store); 332bb77f602SPat Hickey let _instance_type = _instance_pre.instance_type(); 333636435f1SJoel Dice let mut store = store.as_context_mut(); 334636435f1SJoel Dice let _ = &mut store; 335636435f1SJoel Dice let a = *_instance 336636435f1SJoel Dice .get_typed_func::<(&str,), ()>(&mut store, &self.a)? 337636435f1SJoel Dice .func(); 338636435f1SJoel Dice let b = *_instance 339636435f1SJoel Dice .get_typed_func::< 340636435f1SJoel Dice (), 341636435f1SJoel Dice (wasmtime::component::__internal::String,), 342636435f1SJoel Dice >(&mut store, &self.b)? 343636435f1SJoel Dice .func(); 344636435f1SJoel Dice let c = *_instance 345636435f1SJoel Dice .get_typed_func::< 346636435f1SJoel Dice (&str, &str), 347636435f1SJoel Dice (wasmtime::component::__internal::String,), 348636435f1SJoel Dice >(&mut store, &self.c)? 349636435f1SJoel Dice .func(); 350636435f1SJoel Dice Ok(Guest { a, b, c }) 351636435f1SJoel Dice } 352636435f1SJoel Dice } 353636435f1SJoel Dice impl Guest { call_a<_T, _D>( &self, accessor: &wasmtime::component::Accessor<_T, _D>, arg0: wasmtime::component::__internal::String, ) -> wasmtime::Result<()> where _T: Send, _D: wasmtime::component::HasData,35464bc3bd9SAlex Crichton pub async fn call_a<_T, _D>( 355636435f1SJoel Dice &self, 35664bc3bd9SAlex Crichton accessor: &wasmtime::component::Accessor<_T, _D>, 357636435f1SJoel Dice arg0: wasmtime::component::__internal::String, 35864bc3bd9SAlex Crichton ) -> wasmtime::Result<()> 359636435f1SJoel Dice where 36064bc3bd9SAlex Crichton _T: Send, 36164bc3bd9SAlex Crichton _D: wasmtime::component::HasData, 362636435f1SJoel Dice { 363636435f1SJoel Dice let callee = unsafe { 364636435f1SJoel Dice wasmtime::component::TypedFunc::< 365636435f1SJoel Dice (wasmtime::component::__internal::String,), 366636435f1SJoel Dice (), 367636435f1SJoel Dice >::new_unchecked(self.a) 368636435f1SJoel Dice }; 369*1e0b0b46SAlex Crichton let () = callee.call_concurrent(accessor, (arg0,)).await?; 37064bc3bd9SAlex Crichton Ok(()) 371636435f1SJoel Dice } call_b<_T, _D>( &self, accessor: &wasmtime::component::Accessor<_T, _D>, ) -> wasmtime::Result<wasmtime::component::__internal::String> where _T: Send, _D: wasmtime::component::HasData,37264bc3bd9SAlex Crichton pub async fn call_b<_T, _D>( 373636435f1SJoel Dice &self, 37464bc3bd9SAlex Crichton accessor: &wasmtime::component::Accessor<_T, _D>, 37564bc3bd9SAlex Crichton ) -> wasmtime::Result<wasmtime::component::__internal::String> 376636435f1SJoel Dice where 37764bc3bd9SAlex Crichton _T: Send, 37864bc3bd9SAlex Crichton _D: wasmtime::component::HasData, 379636435f1SJoel Dice { 380636435f1SJoel Dice let callee = unsafe { 381636435f1SJoel Dice wasmtime::component::TypedFunc::< 382636435f1SJoel Dice (), 383636435f1SJoel Dice (wasmtime::component::__internal::String,), 384636435f1SJoel Dice >::new_unchecked(self.b) 385636435f1SJoel Dice }; 386*1e0b0b46SAlex Crichton let (ret0,) = callee.call_concurrent(accessor, ()).await?; 387b221fca7SJoel Dice Ok(ret0) 388b221fca7SJoel Dice } call_c<_T, _D>( &self, accessor: &wasmtime::component::Accessor<_T, _D>, arg0: wasmtime::component::__internal::String, arg1: wasmtime::component::__internal::String, ) -> wasmtime::Result<wasmtime::component::__internal::String> where _T: Send, _D: wasmtime::component::HasData,38964bc3bd9SAlex Crichton pub async fn call_c<_T, _D>( 390636435f1SJoel Dice &self, 39164bc3bd9SAlex Crichton accessor: &wasmtime::component::Accessor<_T, _D>, 392636435f1SJoel Dice arg0: wasmtime::component::__internal::String, 393636435f1SJoel Dice arg1: wasmtime::component::__internal::String, 39464bc3bd9SAlex Crichton ) -> wasmtime::Result<wasmtime::component::__internal::String> 395636435f1SJoel Dice where 39664bc3bd9SAlex Crichton _T: Send, 39764bc3bd9SAlex Crichton _D: wasmtime::component::HasData, 398636435f1SJoel Dice { 399636435f1SJoel Dice let callee = unsafe { 400636435f1SJoel Dice wasmtime::component::TypedFunc::< 401636435f1SJoel Dice ( 402636435f1SJoel Dice wasmtime::component::__internal::String, 403636435f1SJoel Dice wasmtime::component::__internal::String, 404636435f1SJoel Dice ), 405636435f1SJoel Dice (wasmtime::component::__internal::String,), 406636435f1SJoel Dice >::new_unchecked(self.c) 407636435f1SJoel Dice }; 408*1e0b0b46SAlex Crichton let (ret0,) = callee 40964bc3bd9SAlex Crichton .call_concurrent(accessor, (arg0, arg1)) 410080faa1aSJoel Dice .await?; 411b221fca7SJoel Dice Ok(ret0) 412b221fca7SJoel Dice } 413636435f1SJoel Dice } 414636435f1SJoel Dice } 415636435f1SJoel Dice } 416636435f1SJoel Dice } 417636435f1SJoel Dice } 418