Path: blob/main/crates/component-macro/tests/expanded/conventions_async.rs
1692 views
/// Auto-generated bindings for a pre-instantiated version of a1/// component which implements the world `the-world`.2///3/// This structure is created through [`TheWorldPre::new`] which4/// takes a [`InstancePre`](wasmtime::component::InstancePre) that5/// has been created through a [`Linker`](wasmtime::component::Linker).6///7/// For more information see [`TheWorld`] as well.8pub struct TheWorldPre<T: 'static> {9instance_pre: wasmtime::component::InstancePre<T>,10indices: TheWorldIndices,11}12impl<T: 'static> Clone for TheWorldPre<T> {13fn clone(&self) -> Self {14Self {15instance_pre: self.instance_pre.clone(),16indices: self.indices.clone(),17}18}19}20impl<_T: 'static> TheWorldPre<_T> {21/// Creates a new copy of `TheWorldPre` bindings which can then22/// be used to instantiate into a particular store.23///24/// This method may fail if the component behind `instance_pre`25/// does not have the required exports.26pub fn new(27instance_pre: wasmtime::component::InstancePre<_T>,28) -> wasmtime::Result<Self> {29let indices = TheWorldIndices::new(&instance_pre)?;30Ok(Self { instance_pre, indices })31}32pub fn engine(&self) -> &wasmtime::Engine {33self.instance_pre.engine()34}35pub fn instance_pre(&self) -> &wasmtime::component::InstancePre<_T> {36&self.instance_pre37}38/// Instantiates a new instance of [`TheWorld`] within the39/// `store` provided.40///41/// This function will use `self` as the pre-instantiated42/// instance to perform instantiation. Afterwards the preloaded43/// indices in `self` are used to lookup all exports on the44/// resulting instance.45pub fn instantiate(46&self,47mut store: impl wasmtime::AsContextMut<Data = _T>,48) -> wasmtime::Result<TheWorld> {49let mut store = store.as_context_mut();50let instance = self.instance_pre.instantiate(&mut store)?;51self.indices.load(&mut store, &instance)52}53}54impl<_T: Send + 'static> TheWorldPre<_T> {55/// Same as [`Self::instantiate`], except with `async`.56pub async fn instantiate_async(57&self,58mut store: impl wasmtime::AsContextMut<Data = _T>,59) -> wasmtime::Result<TheWorld> {60let mut store = store.as_context_mut();61let instance = self.instance_pre.instantiate_async(&mut store).await?;62self.indices.load(&mut store, &instance)63}64}65/// Auto-generated bindings for index of the exports of66/// `the-world`.67///68/// This is an implementation detail of [`TheWorldPre`] and can69/// be constructed if needed as well.70///71/// For more information see [`TheWorld`] as well.72#[derive(Clone)]73pub struct TheWorldIndices {74interface0: exports::foo::foo::conventions::GuestIndices,75}76/// Auto-generated bindings for an instance a component which77/// implements the world `the-world`.78///79/// This structure can be created through a number of means80/// depending on your requirements and what you have on hand:81///82/// * The most convenient way is to use83/// [`TheWorld::instantiate`] which only needs a84/// [`Store`], [`Component`], and [`Linker`].85///86/// * Alternatively you can create a [`TheWorldPre`] ahead of87/// time with a [`Component`] to front-load string lookups88/// of exports once instead of per-instantiation. This89/// method then uses [`TheWorldPre::instantiate`] to90/// create a [`TheWorld`].91///92/// * If you've instantiated the instance yourself already93/// then you can use [`TheWorld::new`].94///95/// These methods are all equivalent to one another and move96/// around the tradeoff of what work is performed when.97///98/// [`Store`]: wasmtime::Store99/// [`Component`]: wasmtime::component::Component100/// [`Linker`]: wasmtime::component::Linker101pub struct TheWorld {102interface0: exports::foo::foo::conventions::Guest,103}104const _: () = {105#[allow(unused_imports)]106use wasmtime::component::__internal::anyhow;107impl TheWorldIndices {108/// Creates a new copy of `TheWorldIndices` bindings which can then109/// be used to instantiate into a particular store.110///111/// This method may fail if the component does not have the112/// required exports.113pub fn new<_T>(114_instance_pre: &wasmtime::component::InstancePre<_T>,115) -> wasmtime::Result<Self> {116let _component = _instance_pre.component();117let _instance_type = _instance_pre.instance_type();118let interface0 = exports::foo::foo::conventions::GuestIndices::new(119_instance_pre,120)?;121Ok(TheWorldIndices { interface0 })122}123/// Uses the indices stored in `self` to load an instance124/// of [`TheWorld`] from the instance provided.125///126/// Note that at this time this method will additionally127/// perform type-checks of all exports.128pub fn load(129&self,130mut store: impl wasmtime::AsContextMut,131instance: &wasmtime::component::Instance,132) -> wasmtime::Result<TheWorld> {133let _ = &mut store;134let _instance = instance;135let interface0 = self.interface0.load(&mut store, &_instance)?;136Ok(TheWorld { interface0 })137}138}139impl TheWorld {140/// Convenience wrapper around [`TheWorldPre::new`] and141/// [`TheWorldPre::instantiate`].142pub fn instantiate<_T>(143store: impl wasmtime::AsContextMut<Data = _T>,144component: &wasmtime::component::Component,145linker: &wasmtime::component::Linker<_T>,146) -> wasmtime::Result<TheWorld> {147let pre = linker.instantiate_pre(component)?;148TheWorldPre::new(pre)?.instantiate(store)149}150/// Convenience wrapper around [`TheWorldIndices::new`] and151/// [`TheWorldIndices::load`].152pub fn new(153mut store: impl wasmtime::AsContextMut,154instance: &wasmtime::component::Instance,155) -> wasmtime::Result<TheWorld> {156let indices = TheWorldIndices::new(&instance.instance_pre(&store))?;157indices.load(&mut store, instance)158}159/// Convenience wrapper around [`TheWorldPre::new`] and160/// [`TheWorldPre::instantiate_async`].161pub async fn instantiate_async<_T>(162store: impl wasmtime::AsContextMut<Data = _T>,163component: &wasmtime::component::Component,164linker: &wasmtime::component::Linker<_T>,165) -> wasmtime::Result<TheWorld>166where167_T: Send,168{169let pre = linker.instantiate_pre(component)?;170TheWorldPre::new(pre)?.instantiate_async(store).await171}172pub fn add_to_linker<T, D>(173linker: &mut wasmtime::component::Linker<T>,174host_getter: fn(&mut T) -> D::Data<'_>,175) -> wasmtime::Result<()>176where177D: foo::foo::conventions::HostWithStore + Send,178for<'a> D::Data<'a>: foo::foo::conventions::Host + Send,179T: 'static + Send,180{181foo::foo::conventions::add_to_linker::<T, D>(linker, host_getter)?;182Ok(())183}184pub fn foo_foo_conventions(&self) -> &exports::foo::foo::conventions::Guest {185&self.interface0186}187}188};189pub mod foo {190pub mod foo {191#[allow(clippy::all)]192pub mod conventions {193#[allow(unused_imports)]194use wasmtime::component::__internal::{anyhow, Box};195#[derive(wasmtime::component::ComponentType)]196#[derive(wasmtime::component::Lift)]197#[derive(wasmtime::component::Lower)]198#[component(record)]199#[derive(Clone, Copy)]200pub struct LudicrousSpeed {201#[component(name = "how-fast-are-you-going")]202pub how_fast_are_you_going: u32,203#[component(name = "i-am-going-extremely-slow")]204pub i_am_going_extremely_slow: u64,205}206impl core::fmt::Debug for LudicrousSpeed {207fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {208f.debug_struct("LudicrousSpeed")209.field("how-fast-are-you-going", &self.how_fast_are_you_going)210.field(211"i-am-going-extremely-slow",212&self.i_am_going_extremely_slow,213)214.finish()215}216}217const _: () = {218assert!(21916 == < LudicrousSpeed as wasmtime::component::ComponentType220>::SIZE32221);222assert!(2238 == < LudicrousSpeed as wasmtime::component::ComponentType224>::ALIGN32225);226};227pub trait HostWithStore: wasmtime::component::HasData + Send {}228impl<_T: ?Sized> HostWithStore for _T229where230_T: wasmtime::component::HasData + Send,231{}232pub trait Host: Send {233fn kebab_case(234&mut self,235) -> impl ::core::future::Future<Output = ()> + Send;236fn foo(237&mut self,238x: LudicrousSpeed,239) -> impl ::core::future::Future<Output = ()> + Send;240fn function_with_dashes(241&mut self,242) -> impl ::core::future::Future<Output = ()> + Send;243fn function_with_no_weird_characters(244&mut self,245) -> impl ::core::future::Future<Output = ()> + Send;246fn apple(&mut self) -> impl ::core::future::Future<Output = ()> + Send;247fn apple_pear(248&mut self,249) -> impl ::core::future::Future<Output = ()> + Send;250fn apple_pear_grape(251&mut self,252) -> impl ::core::future::Future<Output = ()> + Send;253fn a0(&mut self) -> impl ::core::future::Future<Output = ()> + Send;254/// Comment out identifiers that collide when mapped to snake_case, for now; see255/// https://github.com/WebAssembly/component-model/issues/118256/// APPLE: func()257/// APPLE-pear-GRAPE: func()258/// apple-PEAR-grape: func()259fn is_xml(&mut self) -> impl ::core::future::Future<Output = ()> + Send;260fn explicit(261&mut self,262) -> impl ::core::future::Future<Output = ()> + Send;263fn explicit_kebab(264&mut self,265) -> impl ::core::future::Future<Output = ()> + Send;266/// Identifiers with the same name as keywords are quoted.267fn bool(&mut self) -> impl ::core::future::Future<Output = ()> + Send;268}269impl<_T: Host + ?Sized + Send> Host for &mut _T {270fn kebab_case(271&mut self,272) -> impl ::core::future::Future<Output = ()> + Send {273async move { Host::kebab_case(*self).await }274}275fn foo(276&mut self,277x: LudicrousSpeed,278) -> impl ::core::future::Future<Output = ()> + Send {279async move { Host::foo(*self, x).await }280}281fn function_with_dashes(282&mut self,283) -> impl ::core::future::Future<Output = ()> + Send {284async move { Host::function_with_dashes(*self).await }285}286fn function_with_no_weird_characters(287&mut self,288) -> impl ::core::future::Future<Output = ()> + Send {289async move { Host::function_with_no_weird_characters(*self).await }290}291fn apple(&mut self) -> impl ::core::future::Future<Output = ()> + Send {292async move { Host::apple(*self).await }293}294fn apple_pear(295&mut self,296) -> impl ::core::future::Future<Output = ()> + Send {297async move { Host::apple_pear(*self).await }298}299fn apple_pear_grape(300&mut self,301) -> impl ::core::future::Future<Output = ()> + Send {302async move { Host::apple_pear_grape(*self).await }303}304fn a0(&mut self) -> impl ::core::future::Future<Output = ()> + Send {305async move { Host::a0(*self).await }306}307/// Comment out identifiers that collide when mapped to snake_case, for now; see308/// https://github.com/WebAssembly/component-model/issues/118309/// APPLE: func()310/// APPLE-pear-GRAPE: func()311/// apple-PEAR-grape: func()312fn is_xml(&mut self) -> impl ::core::future::Future<Output = ()> + Send {313async move { Host::is_xml(*self).await }314}315fn explicit(316&mut self,317) -> impl ::core::future::Future<Output = ()> + Send {318async move { Host::explicit(*self).await }319}320fn explicit_kebab(321&mut self,322) -> impl ::core::future::Future<Output = ()> + Send {323async move { Host::explicit_kebab(*self).await }324}325/// Identifiers with the same name as keywords are quoted.326fn bool(&mut self) -> impl ::core::future::Future<Output = ()> + Send {327async move { Host::bool(*self).await }328}329}330pub fn add_to_linker<T, D>(331linker: &mut wasmtime::component::Linker<T>,332host_getter: fn(&mut T) -> D::Data<'_>,333) -> wasmtime::Result<()>334where335D: HostWithStore,336for<'a> D::Data<'a>: Host,337T: 'static + Send,338{339let mut inst = linker.instance("foo:foo/conventions")?;340inst.func_wrap_async(341"kebab-case",342move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {343wasmtime::component::__internal::Box::new(async move {344let host = &mut host_getter(caller.data_mut());345let r = Host::kebab_case(host).await;346Ok(r)347})348},349)?;350inst.func_wrap_async(351"foo",352move |353mut caller: wasmtime::StoreContextMut<'_, T>,354(arg0,): (LudicrousSpeed,)|355{356wasmtime::component::__internal::Box::new(async move {357let host = &mut host_getter(caller.data_mut());358let r = Host::foo(host, arg0).await;359Ok(r)360})361},362)?;363inst.func_wrap_async(364"function-with-dashes",365move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {366wasmtime::component::__internal::Box::new(async move {367let host = &mut host_getter(caller.data_mut());368let r = Host::function_with_dashes(host).await;369Ok(r)370})371},372)?;373inst.func_wrap_async(374"function-with-no-weird-characters",375move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {376wasmtime::component::__internal::Box::new(async move {377let host = &mut host_getter(caller.data_mut());378let r = Host::function_with_no_weird_characters(host).await;379Ok(r)380})381},382)?;383inst.func_wrap_async(384"apple",385move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {386wasmtime::component::__internal::Box::new(async move {387let host = &mut host_getter(caller.data_mut());388let r = Host::apple(host).await;389Ok(r)390})391},392)?;393inst.func_wrap_async(394"apple-pear",395move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {396wasmtime::component::__internal::Box::new(async move {397let host = &mut host_getter(caller.data_mut());398let r = Host::apple_pear(host).await;399Ok(r)400})401},402)?;403inst.func_wrap_async(404"apple-pear-grape",405move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {406wasmtime::component::__internal::Box::new(async move {407let host = &mut host_getter(caller.data_mut());408let r = Host::apple_pear_grape(host).await;409Ok(r)410})411},412)?;413inst.func_wrap_async(414"a0",415move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {416wasmtime::component::__internal::Box::new(async move {417let host = &mut host_getter(caller.data_mut());418let r = Host::a0(host).await;419Ok(r)420})421},422)?;423inst.func_wrap_async(424"is-XML",425move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {426wasmtime::component::__internal::Box::new(async move {427let host = &mut host_getter(caller.data_mut());428let r = Host::is_xml(host).await;429Ok(r)430})431},432)?;433inst.func_wrap_async(434"explicit",435move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {436wasmtime::component::__internal::Box::new(async move {437let host = &mut host_getter(caller.data_mut());438let r = Host::explicit(host).await;439Ok(r)440})441},442)?;443inst.func_wrap_async(444"explicit-kebab",445move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {446wasmtime::component::__internal::Box::new(async move {447let host = &mut host_getter(caller.data_mut());448let r = Host::explicit_kebab(host).await;449Ok(r)450})451},452)?;453inst.func_wrap_async(454"bool",455move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {456wasmtime::component::__internal::Box::new(async move {457let host = &mut host_getter(caller.data_mut());458let r = Host::bool(host).await;459Ok(r)460})461},462)?;463Ok(())464}465}466}467}468pub mod exports {469pub mod foo {470pub mod foo {471#[allow(clippy::all)]472pub mod conventions {473#[allow(unused_imports)]474use wasmtime::component::__internal::{anyhow, Box};475#[derive(wasmtime::component::ComponentType)]476#[derive(wasmtime::component::Lift)]477#[derive(wasmtime::component::Lower)]478#[component(record)]479#[derive(Clone, Copy)]480pub struct LudicrousSpeed {481#[component(name = "how-fast-are-you-going")]482pub how_fast_are_you_going: u32,483#[component(name = "i-am-going-extremely-slow")]484pub i_am_going_extremely_slow: u64,485}486impl core::fmt::Debug for LudicrousSpeed {487fn fmt(488&self,489f: &mut core::fmt::Formatter<'_>,490) -> core::fmt::Result {491f.debug_struct("LudicrousSpeed")492.field(493"how-fast-are-you-going",494&self.how_fast_are_you_going,495)496.field(497"i-am-going-extremely-slow",498&self.i_am_going_extremely_slow,499)500.finish()501}502}503const _: () = {504assert!(50516 == < LudicrousSpeed as wasmtime::component::ComponentType506>::SIZE32507);508assert!(5098 == < LudicrousSpeed as wasmtime::component::ComponentType510>::ALIGN32511);512};513pub struct Guest {514kebab_case: wasmtime::component::Func,515foo: wasmtime::component::Func,516function_with_dashes: wasmtime::component::Func,517function_with_no_weird_characters: wasmtime::component::Func,518apple: wasmtime::component::Func,519apple_pear: wasmtime::component::Func,520apple_pear_grape: wasmtime::component::Func,521a0: wasmtime::component::Func,522is_xml: wasmtime::component::Func,523explicit: wasmtime::component::Func,524explicit_kebab: wasmtime::component::Func,525bool: wasmtime::component::Func,526}527#[derive(Clone)]528pub struct GuestIndices {529kebab_case: wasmtime::component::ComponentExportIndex,530foo: wasmtime::component::ComponentExportIndex,531function_with_dashes: wasmtime::component::ComponentExportIndex,532function_with_no_weird_characters: wasmtime::component::ComponentExportIndex,533apple: wasmtime::component::ComponentExportIndex,534apple_pear: wasmtime::component::ComponentExportIndex,535apple_pear_grape: wasmtime::component::ComponentExportIndex,536a0: wasmtime::component::ComponentExportIndex,537is_xml: wasmtime::component::ComponentExportIndex,538explicit: wasmtime::component::ComponentExportIndex,539explicit_kebab: wasmtime::component::ComponentExportIndex,540bool: wasmtime::component::ComponentExportIndex,541}542impl GuestIndices {543/// Constructor for [`GuestIndices`] which takes a544/// [`Component`](wasmtime::component::Component) as input and can be executed545/// before instantiation.546///547/// This constructor can be used to front-load string lookups to find exports548/// within a component.549pub fn new<_T>(550_instance_pre: &wasmtime::component::InstancePre<_T>,551) -> wasmtime::Result<GuestIndices> {552let instance = _instance_pre553.component()554.get_export_index(None, "foo:foo/conventions")555.ok_or_else(|| {556anyhow::anyhow!(557"no exported instance named `foo:foo/conventions`"558)559})?;560let mut lookup = move |name| {561_instance_pre562.component()563.get_export_index(Some(&instance), name)564.ok_or_else(|| {565anyhow::anyhow!(566"instance export `foo:foo/conventions` does \567not have export `{name}`"568)569})570};571let _ = &mut lookup;572let kebab_case = lookup("kebab-case")?;573let foo = lookup("foo")?;574let function_with_dashes = lookup("function-with-dashes")?;575let function_with_no_weird_characters = lookup(576"function-with-no-weird-characters",577)?;578let apple = lookup("apple")?;579let apple_pear = lookup("apple-pear")?;580let apple_pear_grape = lookup("apple-pear-grape")?;581let a0 = lookup("a0")?;582let is_xml = lookup("is-XML")?;583let explicit = lookup("explicit")?;584let explicit_kebab = lookup("explicit-kebab")?;585let bool = lookup("bool")?;586Ok(GuestIndices {587kebab_case,588foo,589function_with_dashes,590function_with_no_weird_characters,591apple,592apple_pear,593apple_pear_grape,594a0,595is_xml,596explicit,597explicit_kebab,598bool,599})600}601pub fn load(602&self,603mut store: impl wasmtime::AsContextMut,604instance: &wasmtime::component::Instance,605) -> wasmtime::Result<Guest> {606let _instance = instance;607let _instance_pre = _instance.instance_pre(&store);608let _instance_type = _instance_pre.instance_type();609let mut store = store.as_context_mut();610let _ = &mut store;611let kebab_case = *_instance612.get_typed_func::<(), ()>(&mut store, &self.kebab_case)?613.func();614let foo = *_instance615.get_typed_func::<616(LudicrousSpeed,),617(),618>(&mut store, &self.foo)?619.func();620let function_with_dashes = *_instance621.get_typed_func::<622(),623(),624>(&mut store, &self.function_with_dashes)?625.func();626let function_with_no_weird_characters = *_instance627.get_typed_func::<628(),629(),630>(&mut store, &self.function_with_no_weird_characters)?631.func();632let apple = *_instance633.get_typed_func::<(), ()>(&mut store, &self.apple)?634.func();635let apple_pear = *_instance636.get_typed_func::<(), ()>(&mut store, &self.apple_pear)?637.func();638let apple_pear_grape = *_instance639.get_typed_func::<640(),641(),642>(&mut store, &self.apple_pear_grape)?643.func();644let a0 = *_instance645.get_typed_func::<(), ()>(&mut store, &self.a0)?646.func();647let is_xml = *_instance648.get_typed_func::<(), ()>(&mut store, &self.is_xml)?649.func();650let explicit = *_instance651.get_typed_func::<(), ()>(&mut store, &self.explicit)?652.func();653let explicit_kebab = *_instance654.get_typed_func::<(), ()>(&mut store, &self.explicit_kebab)?655.func();656let bool = *_instance657.get_typed_func::<(), ()>(&mut store, &self.bool)?658.func();659Ok(Guest {660kebab_case,661foo,662function_with_dashes,663function_with_no_weird_characters,664apple,665apple_pear,666apple_pear_grape,667a0,668is_xml,669explicit,670explicit_kebab,671bool,672})673}674}675impl Guest {676pub async fn call_kebab_case<S: wasmtime::AsContextMut>(677&self,678mut store: S,679) -> wasmtime::Result<()>680where681<S as wasmtime::AsContext>::Data: Send,682{683let callee = unsafe {684wasmtime::component::TypedFunc::<685(),686(),687>::new_unchecked(self.kebab_case)688};689let () = callee.call_async(store.as_context_mut(), ()).await?;690callee.post_return_async(store.as_context_mut()).await?;691Ok(())692}693pub async fn call_foo<S: wasmtime::AsContextMut>(694&self,695mut store: S,696arg0: LudicrousSpeed,697) -> wasmtime::Result<()>698where699<S as wasmtime::AsContext>::Data: Send,700{701let callee = unsafe {702wasmtime::component::TypedFunc::<703(LudicrousSpeed,),704(),705>::new_unchecked(self.foo)706};707let () = callee708.call_async(store.as_context_mut(), (arg0,))709.await?;710callee.post_return_async(store.as_context_mut()).await?;711Ok(())712}713pub async fn call_function_with_dashes<S: wasmtime::AsContextMut>(714&self,715mut store: S,716) -> wasmtime::Result<()>717where718<S as wasmtime::AsContext>::Data: Send,719{720let callee = unsafe {721wasmtime::component::TypedFunc::<722(),723(),724>::new_unchecked(self.function_with_dashes)725};726let () = callee.call_async(store.as_context_mut(), ()).await?;727callee.post_return_async(store.as_context_mut()).await?;728Ok(())729}730pub async fn call_function_with_no_weird_characters<731S: wasmtime::AsContextMut,732>(&self, mut store: S) -> wasmtime::Result<()>733where734<S as wasmtime::AsContext>::Data: Send,735{736let callee = unsafe {737wasmtime::component::TypedFunc::<738(),739(),740>::new_unchecked(self.function_with_no_weird_characters)741};742let () = callee.call_async(store.as_context_mut(), ()).await?;743callee.post_return_async(store.as_context_mut()).await?;744Ok(())745}746pub async fn call_apple<S: wasmtime::AsContextMut>(747&self,748mut store: S,749) -> wasmtime::Result<()>750where751<S as wasmtime::AsContext>::Data: Send,752{753let callee = unsafe {754wasmtime::component::TypedFunc::<755(),756(),757>::new_unchecked(self.apple)758};759let () = callee.call_async(store.as_context_mut(), ()).await?;760callee.post_return_async(store.as_context_mut()).await?;761Ok(())762}763pub async fn call_apple_pear<S: wasmtime::AsContextMut>(764&self,765mut store: S,766) -> wasmtime::Result<()>767where768<S as wasmtime::AsContext>::Data: Send,769{770let callee = unsafe {771wasmtime::component::TypedFunc::<772(),773(),774>::new_unchecked(self.apple_pear)775};776let () = callee.call_async(store.as_context_mut(), ()).await?;777callee.post_return_async(store.as_context_mut()).await?;778Ok(())779}780pub async fn call_apple_pear_grape<S: wasmtime::AsContextMut>(781&self,782mut store: S,783) -> wasmtime::Result<()>784where785<S as wasmtime::AsContext>::Data: Send,786{787let callee = unsafe {788wasmtime::component::TypedFunc::<789(),790(),791>::new_unchecked(self.apple_pear_grape)792};793let () = callee.call_async(store.as_context_mut(), ()).await?;794callee.post_return_async(store.as_context_mut()).await?;795Ok(())796}797pub async fn call_a0<S: wasmtime::AsContextMut>(798&self,799mut store: S,800) -> wasmtime::Result<()>801where802<S as wasmtime::AsContext>::Data: Send,803{804let callee = unsafe {805wasmtime::component::TypedFunc::<806(),807(),808>::new_unchecked(self.a0)809};810let () = callee.call_async(store.as_context_mut(), ()).await?;811callee.post_return_async(store.as_context_mut()).await?;812Ok(())813}814/// Comment out identifiers that collide when mapped to snake_case, for now; see815/// https://github.com/WebAssembly/component-model/issues/118816/// APPLE: func()817/// APPLE-pear-GRAPE: func()818/// apple-PEAR-grape: func()819pub async fn call_is_xml<S: wasmtime::AsContextMut>(820&self,821mut store: S,822) -> wasmtime::Result<()>823where824<S as wasmtime::AsContext>::Data: Send,825{826let callee = unsafe {827wasmtime::component::TypedFunc::<828(),829(),830>::new_unchecked(self.is_xml)831};832let () = callee.call_async(store.as_context_mut(), ()).await?;833callee.post_return_async(store.as_context_mut()).await?;834Ok(())835}836pub async fn call_explicit<S: wasmtime::AsContextMut>(837&self,838mut store: S,839) -> wasmtime::Result<()>840where841<S as wasmtime::AsContext>::Data: Send,842{843let callee = unsafe {844wasmtime::component::TypedFunc::<845(),846(),847>::new_unchecked(self.explicit)848};849let () = callee.call_async(store.as_context_mut(), ()).await?;850callee.post_return_async(store.as_context_mut()).await?;851Ok(())852}853pub async fn call_explicit_kebab<S: wasmtime::AsContextMut>(854&self,855mut store: S,856) -> wasmtime::Result<()>857where858<S as wasmtime::AsContext>::Data: Send,859{860let callee = unsafe {861wasmtime::component::TypedFunc::<862(),863(),864>::new_unchecked(self.explicit_kebab)865};866let () = callee.call_async(store.as_context_mut(), ()).await?;867callee.post_return_async(store.as_context_mut()).await?;868Ok(())869}870/// Identifiers with the same name as keywords are quoted.871pub async fn call_bool<S: wasmtime::AsContextMut>(872&self,873mut store: S,874) -> wasmtime::Result<()>875where876<S as wasmtime::AsContext>::Data: Send,877{878let callee = unsafe {879wasmtime::component::TypedFunc::<880(),881(),882>::new_unchecked(self.bool)883};884let () = callee.call_async(store.as_context_mut(), ()).await?;885callee.post_return_async(store.as_context_mut()).await?;886Ok(())887}888}889}890}891}892}893894895