Path: blob/main/crates/component-macro/tests/expanded/conventions_tracing_async.rs
3092 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 _: () = {105impl TheWorldIndices {106/// Creates a new copy of `TheWorldIndices` bindings which can then107/// be used to instantiate into a particular store.108///109/// This method may fail if the component does not have the110/// required exports.111pub fn new<_T>(112_instance_pre: &wasmtime::component::InstancePre<_T>,113) -> wasmtime::Result<Self> {114let _component = _instance_pre.component();115let _instance_type = _instance_pre.instance_type();116let interface0 = exports::foo::foo::conventions::GuestIndices::new(117_instance_pre,118)?;119Ok(TheWorldIndices { interface0 })120}121/// Uses the indices stored in `self` to load an instance122/// of [`TheWorld`] from the instance provided.123///124/// Note that at this time this method will additionally125/// perform type-checks of all exports.126pub fn load(127&self,128mut store: impl wasmtime::AsContextMut,129instance: &wasmtime::component::Instance,130) -> wasmtime::Result<TheWorld> {131let _ = &mut store;132let _instance = instance;133let interface0 = self.interface0.load(&mut store, &_instance)?;134Ok(TheWorld { interface0 })135}136}137impl TheWorld {138/// Convenience wrapper around [`TheWorldPre::new`] and139/// [`TheWorldPre::instantiate`].140pub fn instantiate<_T>(141store: impl wasmtime::AsContextMut<Data = _T>,142component: &wasmtime::component::Component,143linker: &wasmtime::component::Linker<_T>,144) -> wasmtime::Result<TheWorld> {145let pre = linker.instantiate_pre(component)?;146TheWorldPre::new(pre)?.instantiate(store)147}148/// Convenience wrapper around [`TheWorldIndices::new`] and149/// [`TheWorldIndices::load`].150pub fn new(151mut store: impl wasmtime::AsContextMut,152instance: &wasmtime::component::Instance,153) -> wasmtime::Result<TheWorld> {154let indices = TheWorldIndices::new(&instance.instance_pre(&store))?;155indices.load(&mut store, instance)156}157/// Convenience wrapper around [`TheWorldPre::new`] and158/// [`TheWorldPre::instantiate_async`].159pub async fn instantiate_async<_T>(160store: impl wasmtime::AsContextMut<Data = _T>,161component: &wasmtime::component::Component,162linker: &wasmtime::component::Linker<_T>,163) -> wasmtime::Result<TheWorld>164where165_T: Send,166{167let pre = linker.instantiate_pre(component)?;168TheWorldPre::new(pre)?.instantiate_async(store).await169}170pub fn add_to_linker<T, D>(171linker: &mut wasmtime::component::Linker<T>,172host_getter: fn(&mut T) -> D::Data<'_>,173) -> wasmtime::Result<()>174where175D: foo::foo::conventions::HostWithStore + Send,176for<'a> D::Data<'a>: foo::foo::conventions::Host + Send,177T: 'static + Send,178{179foo::foo::conventions::add_to_linker::<T, D>(linker, host_getter)?;180Ok(())181}182pub fn foo_foo_conventions(&self) -> &exports::foo::foo::conventions::Guest {183&self.interface0184}185}186};187pub mod foo {188pub mod foo {189#[allow(clippy::all)]190pub mod conventions {191#[allow(unused_imports)]192use wasmtime::component::__internal::Box;193#[derive(wasmtime::component::ComponentType)]194#[derive(wasmtime::component::Lift)]195#[derive(wasmtime::component::Lower)]196#[component(record)]197#[derive(Clone, Copy)]198pub struct LudicrousSpeed {199#[component(name = "how-fast-are-you-going")]200pub how_fast_are_you_going: u32,201#[component(name = "i-am-going-extremely-slow")]202pub i_am_going_extremely_slow: u64,203}204impl core::fmt::Debug for LudicrousSpeed {205fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {206f.debug_struct("LudicrousSpeed")207.field("how-fast-are-you-going", &self.how_fast_are_you_going)208.field(209"i-am-going-extremely-slow",210&self.i_am_going_extremely_slow,211)212.finish()213}214}215const _: () = {216assert!(21716 == < LudicrousSpeed as wasmtime::component::ComponentType218>::SIZE32219);220assert!(2218 == < LudicrousSpeed as wasmtime::component::ComponentType222>::ALIGN32223);224};225pub trait HostWithStore: wasmtime::component::HasData + Send {}226impl<_T: ?Sized> HostWithStore for _T227where228_T: wasmtime::component::HasData + Send,229{}230pub trait Host: Send {231fn kebab_case(232&mut self,233) -> impl ::core::future::Future<Output = ()> + Send;234fn foo(235&mut self,236x: LudicrousSpeed,237) -> impl ::core::future::Future<Output = ()> + Send;238fn function_with_dashes(239&mut self,240) -> impl ::core::future::Future<Output = ()> + Send;241fn function_with_no_weird_characters(242&mut self,243) -> impl ::core::future::Future<Output = ()> + Send;244fn apple(&mut self) -> impl ::core::future::Future<Output = ()> + Send;245fn apple_pear(246&mut self,247) -> impl ::core::future::Future<Output = ()> + Send;248fn apple_pear_grape(249&mut self,250) -> impl ::core::future::Future<Output = ()> + Send;251fn a0(&mut self) -> impl ::core::future::Future<Output = ()> + Send;252/// Comment out identifiers that collide when mapped to snake_case, for now; see253/// https://github.com/WebAssembly/component-model/issues/118254/// APPLE: func()255/// APPLE-pear-GRAPE: func()256/// apple-PEAR-grape: func()257fn is_xml(&mut self) -> impl ::core::future::Future<Output = ()> + Send;258fn explicit(259&mut self,260) -> impl ::core::future::Future<Output = ()> + Send;261fn explicit_kebab(262&mut self,263) -> impl ::core::future::Future<Output = ()> + Send;264/// Identifiers with the same name as keywords are quoted.265fn bool(&mut self) -> impl ::core::future::Future<Output = ()> + Send;266}267impl<_T: Host + ?Sized + Send> Host for &mut _T {268fn kebab_case(269&mut self,270) -> impl ::core::future::Future<Output = ()> + Send {271async move { Host::kebab_case(*self).await }272}273fn foo(274&mut self,275x: LudicrousSpeed,276) -> impl ::core::future::Future<Output = ()> + Send {277async move { Host::foo(*self, x).await }278}279fn function_with_dashes(280&mut self,281) -> impl ::core::future::Future<Output = ()> + Send {282async move { Host::function_with_dashes(*self).await }283}284fn function_with_no_weird_characters(285&mut self,286) -> impl ::core::future::Future<Output = ()> + Send {287async move { Host::function_with_no_weird_characters(*self).await }288}289fn apple(&mut self) -> impl ::core::future::Future<Output = ()> + Send {290async move { Host::apple(*self).await }291}292fn apple_pear(293&mut self,294) -> impl ::core::future::Future<Output = ()> + Send {295async move { Host::apple_pear(*self).await }296}297fn apple_pear_grape(298&mut self,299) -> impl ::core::future::Future<Output = ()> + Send {300async move { Host::apple_pear_grape(*self).await }301}302fn a0(&mut self) -> impl ::core::future::Future<Output = ()> + Send {303async move { Host::a0(*self).await }304}305/// Comment out identifiers that collide when mapped to snake_case, for now; see306/// https://github.com/WebAssembly/component-model/issues/118307/// APPLE: func()308/// APPLE-pear-GRAPE: func()309/// apple-PEAR-grape: func()310fn is_xml(&mut self) -> impl ::core::future::Future<Output = ()> + Send {311async move { Host::is_xml(*self).await }312}313fn explicit(314&mut self,315) -> impl ::core::future::Future<Output = ()> + Send {316async move { Host::explicit(*self).await }317}318fn explicit_kebab(319&mut self,320) -> impl ::core::future::Future<Output = ()> + Send {321async move { Host::explicit_kebab(*self).await }322}323/// Identifiers with the same name as keywords are quoted.324fn bool(&mut self) -> impl ::core::future::Future<Output = ()> + Send {325async move { Host::bool(*self).await }326}327}328pub fn add_to_linker<T, D>(329linker: &mut wasmtime::component::Linker<T>,330host_getter: fn(&mut T) -> D::Data<'_>,331) -> wasmtime::Result<()>332where333D: HostWithStore,334for<'a> D::Data<'a>: Host,335T: 'static + Send,336{337let mut inst = linker.instance("foo:foo/conventions")?;338inst.func_wrap_async(339"kebab-case",340move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {341use tracing::Instrument;342let span = tracing::span!(343tracing::Level::TRACE, "wit-bindgen import", module =344"conventions", function = "kebab-case",345);346wasmtime::component::__internal::Box::new(347async move {348tracing::event!(tracing::Level::TRACE, "call");349let host = &mut host_getter(caller.data_mut());350let r = Host::kebab_case(host).await;351tracing::event!(352tracing::Level::TRACE, result = tracing::field::debug(& r),353"return"354);355Ok(r)356}357.instrument(span),358)359},360)?;361inst.func_wrap_async(362"foo",363move |364mut caller: wasmtime::StoreContextMut<'_, T>,365(arg0,): (LudicrousSpeed,)|366{367use tracing::Instrument;368let span = tracing::span!(369tracing::Level::TRACE, "wit-bindgen import", module =370"conventions", function = "foo",371);372wasmtime::component::__internal::Box::new(373async move {374tracing::event!(375tracing::Level::TRACE, x = tracing::field::debug(& arg0),376"call"377);378let host = &mut host_getter(caller.data_mut());379let r = Host::foo(host, arg0).await;380tracing::event!(381tracing::Level::TRACE, result = tracing::field::debug(& r),382"return"383);384Ok(r)385}386.instrument(span),387)388},389)?;390inst.func_wrap_async(391"function-with-dashes",392move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {393use tracing::Instrument;394let span = tracing::span!(395tracing::Level::TRACE, "wit-bindgen import", module =396"conventions", function = "function-with-dashes",397);398wasmtime::component::__internal::Box::new(399async move {400tracing::event!(tracing::Level::TRACE, "call");401let host = &mut host_getter(caller.data_mut());402let r = Host::function_with_dashes(host).await;403tracing::event!(404tracing::Level::TRACE, result = tracing::field::debug(& r),405"return"406);407Ok(r)408}409.instrument(span),410)411},412)?;413inst.func_wrap_async(414"function-with-no-weird-characters",415move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {416use tracing::Instrument;417let span = tracing::span!(418tracing::Level::TRACE, "wit-bindgen import", module =419"conventions", function =420"function-with-no-weird-characters",421);422wasmtime::component::__internal::Box::new(423async move {424tracing::event!(tracing::Level::TRACE, "call");425let host = &mut host_getter(caller.data_mut());426let r = Host::function_with_no_weird_characters(host).await;427tracing::event!(428tracing::Level::TRACE, result = tracing::field::debug(& r),429"return"430);431Ok(r)432}433.instrument(span),434)435},436)?;437inst.func_wrap_async(438"apple",439move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {440use tracing::Instrument;441let span = tracing::span!(442tracing::Level::TRACE, "wit-bindgen import", module =443"conventions", function = "apple",444);445wasmtime::component::__internal::Box::new(446async move {447tracing::event!(tracing::Level::TRACE, "call");448let host = &mut host_getter(caller.data_mut());449let r = Host::apple(host).await;450tracing::event!(451tracing::Level::TRACE, result = tracing::field::debug(& r),452"return"453);454Ok(r)455}456.instrument(span),457)458},459)?;460inst.func_wrap_async(461"apple-pear",462move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {463use tracing::Instrument;464let span = tracing::span!(465tracing::Level::TRACE, "wit-bindgen import", module =466"conventions", function = "apple-pear",467);468wasmtime::component::__internal::Box::new(469async move {470tracing::event!(tracing::Level::TRACE, "call");471let host = &mut host_getter(caller.data_mut());472let r = Host::apple_pear(host).await;473tracing::event!(474tracing::Level::TRACE, result = tracing::field::debug(& r),475"return"476);477Ok(r)478}479.instrument(span),480)481},482)?;483inst.func_wrap_async(484"apple-pear-grape",485move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {486use tracing::Instrument;487let span = tracing::span!(488tracing::Level::TRACE, "wit-bindgen import", module =489"conventions", function = "apple-pear-grape",490);491wasmtime::component::__internal::Box::new(492async move {493tracing::event!(tracing::Level::TRACE, "call");494let host = &mut host_getter(caller.data_mut());495let r = Host::apple_pear_grape(host).await;496tracing::event!(497tracing::Level::TRACE, result = tracing::field::debug(& r),498"return"499);500Ok(r)501}502.instrument(span),503)504},505)?;506inst.func_wrap_async(507"a0",508move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {509use tracing::Instrument;510let span = tracing::span!(511tracing::Level::TRACE, "wit-bindgen import", module =512"conventions", function = "a0",513);514wasmtime::component::__internal::Box::new(515async move {516tracing::event!(tracing::Level::TRACE, "call");517let host = &mut host_getter(caller.data_mut());518let r = Host::a0(host).await;519tracing::event!(520tracing::Level::TRACE, result = tracing::field::debug(& r),521"return"522);523Ok(r)524}525.instrument(span),526)527},528)?;529inst.func_wrap_async(530"is-XML",531move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {532use tracing::Instrument;533let span = tracing::span!(534tracing::Level::TRACE, "wit-bindgen import", module =535"conventions", function = "is-XML",536);537wasmtime::component::__internal::Box::new(538async move {539tracing::event!(tracing::Level::TRACE, "call");540let host = &mut host_getter(caller.data_mut());541let r = Host::is_xml(host).await;542tracing::event!(543tracing::Level::TRACE, result = tracing::field::debug(& r),544"return"545);546Ok(r)547}548.instrument(span),549)550},551)?;552inst.func_wrap_async(553"explicit",554move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {555use tracing::Instrument;556let span = tracing::span!(557tracing::Level::TRACE, "wit-bindgen import", module =558"conventions", function = "explicit",559);560wasmtime::component::__internal::Box::new(561async move {562tracing::event!(tracing::Level::TRACE, "call");563let host = &mut host_getter(caller.data_mut());564let r = Host::explicit(host).await;565tracing::event!(566tracing::Level::TRACE, result = tracing::field::debug(& r),567"return"568);569Ok(r)570}571.instrument(span),572)573},574)?;575inst.func_wrap_async(576"explicit-kebab",577move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {578use tracing::Instrument;579let span = tracing::span!(580tracing::Level::TRACE, "wit-bindgen import", module =581"conventions", function = "explicit-kebab",582);583wasmtime::component::__internal::Box::new(584async move {585tracing::event!(tracing::Level::TRACE, "call");586let host = &mut host_getter(caller.data_mut());587let r = Host::explicit_kebab(host).await;588tracing::event!(589tracing::Level::TRACE, result = tracing::field::debug(& r),590"return"591);592Ok(r)593}594.instrument(span),595)596},597)?;598inst.func_wrap_async(599"bool",600move |mut caller: wasmtime::StoreContextMut<'_, T>, (): ()| {601use tracing::Instrument;602let span = tracing::span!(603tracing::Level::TRACE, "wit-bindgen import", module =604"conventions", function = "bool",605);606wasmtime::component::__internal::Box::new(607async move {608tracing::event!(tracing::Level::TRACE, "call");609let host = &mut host_getter(caller.data_mut());610let r = Host::bool(host).await;611tracing::event!(612tracing::Level::TRACE, result = tracing::field::debug(& r),613"return"614);615Ok(r)616}617.instrument(span),618)619},620)?;621Ok(())622}623}624}625}626pub mod exports {627pub mod foo {628pub mod foo {629#[allow(clippy::all)]630pub mod conventions {631#[allow(unused_imports)]632use wasmtime::component::__internal::Box;633#[derive(wasmtime::component::ComponentType)]634#[derive(wasmtime::component::Lift)]635#[derive(wasmtime::component::Lower)]636#[component(record)]637#[derive(Clone, Copy)]638pub struct LudicrousSpeed {639#[component(name = "how-fast-are-you-going")]640pub how_fast_are_you_going: u32,641#[component(name = "i-am-going-extremely-slow")]642pub i_am_going_extremely_slow: u64,643}644impl core::fmt::Debug for LudicrousSpeed {645fn fmt(646&self,647f: &mut core::fmt::Formatter<'_>,648) -> core::fmt::Result {649f.debug_struct("LudicrousSpeed")650.field(651"how-fast-are-you-going",652&self.how_fast_are_you_going,653)654.field(655"i-am-going-extremely-slow",656&self.i_am_going_extremely_slow,657)658.finish()659}660}661const _: () = {662assert!(66316 == < LudicrousSpeed as wasmtime::component::ComponentType664>::SIZE32665);666assert!(6678 == < LudicrousSpeed as wasmtime::component::ComponentType668>::ALIGN32669);670};671#[derive(Clone)]672pub struct Guest {673kebab_case: wasmtime::component::Func,674foo: wasmtime::component::Func,675function_with_dashes: wasmtime::component::Func,676function_with_no_weird_characters: wasmtime::component::Func,677apple: wasmtime::component::Func,678apple_pear: wasmtime::component::Func,679apple_pear_grape: wasmtime::component::Func,680a0: wasmtime::component::Func,681is_xml: wasmtime::component::Func,682explicit: wasmtime::component::Func,683explicit_kebab: wasmtime::component::Func,684bool: wasmtime::component::Func,685}686#[derive(Clone)]687pub struct GuestIndices {688kebab_case: wasmtime::component::ComponentExportIndex,689foo: wasmtime::component::ComponentExportIndex,690function_with_dashes: wasmtime::component::ComponentExportIndex,691function_with_no_weird_characters: wasmtime::component::ComponentExportIndex,692apple: wasmtime::component::ComponentExportIndex,693apple_pear: wasmtime::component::ComponentExportIndex,694apple_pear_grape: wasmtime::component::ComponentExportIndex,695a0: wasmtime::component::ComponentExportIndex,696is_xml: wasmtime::component::ComponentExportIndex,697explicit: wasmtime::component::ComponentExportIndex,698explicit_kebab: wasmtime::component::ComponentExportIndex,699bool: wasmtime::component::ComponentExportIndex,700}701impl GuestIndices {702/// Constructor for [`GuestIndices`] which takes a703/// [`Component`](wasmtime::component::Component) as input and can be executed704/// before instantiation.705///706/// This constructor can be used to front-load string lookups to find exports707/// within a component.708pub fn new<_T>(709_instance_pre: &wasmtime::component::InstancePre<_T>,710) -> wasmtime::Result<GuestIndices> {711let instance = _instance_pre712.component()713.get_export_index(None, "foo:foo/conventions")714.ok_or_else(|| {715wasmtime::format_err!(716"no exported instance named `foo:foo/conventions`"717)718})?;719let mut lookup = move |name| {720_instance_pre721.component()722.get_export_index(Some(&instance), name)723.ok_or_else(|| {724wasmtime::format_err!(725"instance export `foo:foo/conventions` does \726not have export `{name}`"727)728})729};730let _ = &mut lookup;731let kebab_case = lookup("kebab-case")?;732let foo = lookup("foo")?;733let function_with_dashes = lookup("function-with-dashes")?;734let function_with_no_weird_characters = lookup(735"function-with-no-weird-characters",736)?;737let apple = lookup("apple")?;738let apple_pear = lookup("apple-pear")?;739let apple_pear_grape = lookup("apple-pear-grape")?;740let a0 = lookup("a0")?;741let is_xml = lookup("is-XML")?;742let explicit = lookup("explicit")?;743let explicit_kebab = lookup("explicit-kebab")?;744let bool = lookup("bool")?;745Ok(GuestIndices {746kebab_case,747foo,748function_with_dashes,749function_with_no_weird_characters,750apple,751apple_pear,752apple_pear_grape,753a0,754is_xml,755explicit,756explicit_kebab,757bool,758})759}760pub fn load(761&self,762mut store: impl wasmtime::AsContextMut,763instance: &wasmtime::component::Instance,764) -> wasmtime::Result<Guest> {765let _instance = instance;766let _instance_pre = _instance.instance_pre(&store);767let _instance_type = _instance_pre.instance_type();768let mut store = store.as_context_mut();769let _ = &mut store;770let kebab_case = *_instance771.get_typed_func::<(), ()>(&mut store, &self.kebab_case)?772.func();773let foo = *_instance774.get_typed_func::<775(LudicrousSpeed,),776(),777>(&mut store, &self.foo)?778.func();779let function_with_dashes = *_instance780.get_typed_func::<781(),782(),783>(&mut store, &self.function_with_dashes)?784.func();785let function_with_no_weird_characters = *_instance786.get_typed_func::<787(),788(),789>(&mut store, &self.function_with_no_weird_characters)?790.func();791let apple = *_instance792.get_typed_func::<(), ()>(&mut store, &self.apple)?793.func();794let apple_pear = *_instance795.get_typed_func::<(), ()>(&mut store, &self.apple_pear)?796.func();797let apple_pear_grape = *_instance798.get_typed_func::<799(),800(),801>(&mut store, &self.apple_pear_grape)?802.func();803let a0 = *_instance804.get_typed_func::<(), ()>(&mut store, &self.a0)?805.func();806let is_xml = *_instance807.get_typed_func::<(), ()>(&mut store, &self.is_xml)?808.func();809let explicit = *_instance810.get_typed_func::<(), ()>(&mut store, &self.explicit)?811.func();812let explicit_kebab = *_instance813.get_typed_func::<(), ()>(&mut store, &self.explicit_kebab)?814.func();815let bool = *_instance816.get_typed_func::<(), ()>(&mut store, &self.bool)?817.func();818Ok(Guest {819kebab_case,820foo,821function_with_dashes,822function_with_no_weird_characters,823apple,824apple_pear,825apple_pear_grape,826a0,827is_xml,828explicit,829explicit_kebab,830bool,831})832}833}834impl Guest {835pub async fn call_kebab_case<S: wasmtime::AsContextMut>(836&self,837mut store: S,838) -> wasmtime::Result<()>839where840<S as wasmtime::AsContext>::Data: Send,841{842use tracing::Instrument;843let span = tracing::span!(844tracing::Level::TRACE, "wit-bindgen export", module =845"foo:foo/conventions", function = "kebab-case",846);847let callee = unsafe {848wasmtime::component::TypedFunc::<849(),850(),851>::new_unchecked(self.kebab_case)852};853let () = callee854.call_async(store.as_context_mut(), ())855.instrument(span.clone())856.await?;857Ok(())858}859pub async fn call_foo<S: wasmtime::AsContextMut>(860&self,861mut store: S,862arg0: LudicrousSpeed,863) -> wasmtime::Result<()>864where865<S as wasmtime::AsContext>::Data: Send,866{867use tracing::Instrument;868let span = tracing::span!(869tracing::Level::TRACE, "wit-bindgen export", module =870"foo:foo/conventions", function = "foo",871);872let callee = unsafe {873wasmtime::component::TypedFunc::<874(LudicrousSpeed,),875(),876>::new_unchecked(self.foo)877};878let () = callee879.call_async(store.as_context_mut(), (arg0,))880.instrument(span.clone())881.await?;882Ok(())883}884pub async fn call_function_with_dashes<S: wasmtime::AsContextMut>(885&self,886mut store: S,887) -> wasmtime::Result<()>888where889<S as wasmtime::AsContext>::Data: Send,890{891use tracing::Instrument;892let span = tracing::span!(893tracing::Level::TRACE, "wit-bindgen export", module =894"foo:foo/conventions", function = "function-with-dashes",895);896let callee = unsafe {897wasmtime::component::TypedFunc::<898(),899(),900>::new_unchecked(self.function_with_dashes)901};902let () = callee903.call_async(store.as_context_mut(), ())904.instrument(span.clone())905.await?;906Ok(())907}908pub async fn call_function_with_no_weird_characters<909S: wasmtime::AsContextMut,910>(&self, mut store: S) -> wasmtime::Result<()>911where912<S as wasmtime::AsContext>::Data: Send,913{914use tracing::Instrument;915let span = tracing::span!(916tracing::Level::TRACE, "wit-bindgen export", module =917"foo:foo/conventions", function =918"function-with-no-weird-characters",919);920let callee = unsafe {921wasmtime::component::TypedFunc::<922(),923(),924>::new_unchecked(self.function_with_no_weird_characters)925};926let () = callee927.call_async(store.as_context_mut(), ())928.instrument(span.clone())929.await?;930Ok(())931}932pub async fn call_apple<S: wasmtime::AsContextMut>(933&self,934mut store: S,935) -> wasmtime::Result<()>936where937<S as wasmtime::AsContext>::Data: Send,938{939use tracing::Instrument;940let span = tracing::span!(941tracing::Level::TRACE, "wit-bindgen export", module =942"foo:foo/conventions", function = "apple",943);944let callee = unsafe {945wasmtime::component::TypedFunc::<946(),947(),948>::new_unchecked(self.apple)949};950let () = callee951.call_async(store.as_context_mut(), ())952.instrument(span.clone())953.await?;954Ok(())955}956pub async fn call_apple_pear<S: wasmtime::AsContextMut>(957&self,958mut store: S,959) -> wasmtime::Result<()>960where961<S as wasmtime::AsContext>::Data: Send,962{963use tracing::Instrument;964let span = tracing::span!(965tracing::Level::TRACE, "wit-bindgen export", module =966"foo:foo/conventions", function = "apple-pear",967);968let callee = unsafe {969wasmtime::component::TypedFunc::<970(),971(),972>::new_unchecked(self.apple_pear)973};974let () = callee975.call_async(store.as_context_mut(), ())976.instrument(span.clone())977.await?;978Ok(())979}980pub async fn call_apple_pear_grape<S: wasmtime::AsContextMut>(981&self,982mut store: S,983) -> wasmtime::Result<()>984where985<S as wasmtime::AsContext>::Data: Send,986{987use tracing::Instrument;988let span = tracing::span!(989tracing::Level::TRACE, "wit-bindgen export", module =990"foo:foo/conventions", function = "apple-pear-grape",991);992let callee = unsafe {993wasmtime::component::TypedFunc::<994(),995(),996>::new_unchecked(self.apple_pear_grape)997};998let () = callee999.call_async(store.as_context_mut(), ())1000.instrument(span.clone())1001.await?;1002Ok(())1003}1004pub async fn call_a0<S: wasmtime::AsContextMut>(1005&self,1006mut store: S,1007) -> wasmtime::Result<()>1008where1009<S as wasmtime::AsContext>::Data: Send,1010{1011use tracing::Instrument;1012let span = tracing::span!(1013tracing::Level::TRACE, "wit-bindgen export", module =1014"foo:foo/conventions", function = "a0",1015);1016let callee = unsafe {1017wasmtime::component::TypedFunc::<1018(),1019(),1020>::new_unchecked(self.a0)1021};1022let () = callee1023.call_async(store.as_context_mut(), ())1024.instrument(span.clone())1025.await?;1026Ok(())1027}1028/// Comment out identifiers that collide when mapped to snake_case, for now; see1029/// https://github.com/WebAssembly/component-model/issues/1181030/// APPLE: func()1031/// APPLE-pear-GRAPE: func()1032/// apple-PEAR-grape: func()1033pub async fn call_is_xml<S: wasmtime::AsContextMut>(1034&self,1035mut store: S,1036) -> wasmtime::Result<()>1037where1038<S as wasmtime::AsContext>::Data: Send,1039{1040use tracing::Instrument;1041let span = tracing::span!(1042tracing::Level::TRACE, "wit-bindgen export", module =1043"foo:foo/conventions", function = "is-XML",1044);1045let callee = unsafe {1046wasmtime::component::TypedFunc::<1047(),1048(),1049>::new_unchecked(self.is_xml)1050};1051let () = callee1052.call_async(store.as_context_mut(), ())1053.instrument(span.clone())1054.await?;1055Ok(())1056}1057pub async fn call_explicit<S: wasmtime::AsContextMut>(1058&self,1059mut store: S,1060) -> wasmtime::Result<()>1061where1062<S as wasmtime::AsContext>::Data: Send,1063{1064use tracing::Instrument;1065let span = tracing::span!(1066tracing::Level::TRACE, "wit-bindgen export", module =1067"foo:foo/conventions", function = "explicit",1068);1069let callee = unsafe {1070wasmtime::component::TypedFunc::<1071(),1072(),1073>::new_unchecked(self.explicit)1074};1075let () = callee1076.call_async(store.as_context_mut(), ())1077.instrument(span.clone())1078.await?;1079Ok(())1080}1081pub async fn call_explicit_kebab<S: wasmtime::AsContextMut>(1082&self,1083mut store: S,1084) -> wasmtime::Result<()>1085where1086<S as wasmtime::AsContext>::Data: Send,1087{1088use tracing::Instrument;1089let span = tracing::span!(1090tracing::Level::TRACE, "wit-bindgen export", module =1091"foo:foo/conventions", function = "explicit-kebab",1092);1093let callee = unsafe {1094wasmtime::component::TypedFunc::<1095(),1096(),1097>::new_unchecked(self.explicit_kebab)1098};1099let () = callee1100.call_async(store.as_context_mut(), ())1101.instrument(span.clone())1102.await?;1103Ok(())1104}1105/// Identifiers with the same name as keywords are quoted.1106pub async fn call_bool<S: wasmtime::AsContextMut>(1107&self,1108mut store: S,1109) -> wasmtime::Result<()>1110where1111<S as wasmtime::AsContext>::Data: Send,1112{1113use tracing::Instrument;1114let span = tracing::span!(1115tracing::Level::TRACE, "wit-bindgen export", module =1116"foo:foo/conventions", function = "bool",1117);1118let callee = unsafe {1119wasmtime::component::TypedFunc::<1120(),1121(),1122>::new_unchecked(self.bool)1123};1124let () = callee1125.call_async(store.as_context_mut(), ())1126.instrument(span.clone())1127.await?;1128Ok(())1129}1130}1131}1132}1133}1134}113511361137