Skip to content

Commit 2472422

Browse files
committed
component macro tests: bless bindgen output
1 parent a0f83a5 commit 2472422

File tree

136 files changed

+3319
-1067
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+3319
-1067
lines changed

crates/component-macro/tests/expanded/char.rs

+27-10
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ impl<_T> TheWorldPre<_T> {
2727
pub fn new(
2828
instance_pre: wasmtime::component::InstancePre<_T>,
2929
) -> wasmtime::Result<Self> {
30-
let indices = TheWorldIndices::new(instance_pre.component())?;
30+
let indices = TheWorldIndices::new(
31+
instance_pre.component(),
32+
instance_pre.instance_type(),
33+
)?;
3134
Ok(Self { instance_pre, indices })
3235
}
3336
pub fn engine(&self) -> &wasmtime::Engine {
@@ -107,9 +110,14 @@ const _: () = {
107110
/// required exports.
108111
pub fn new(
109112
component: &wasmtime::component::Component,
113+
instance_type: &wasmtime::component::__internal::InstanceType,
110114
) -> wasmtime::Result<Self> {
111115
let _component = component;
112-
let interface0 = exports::foo::foo::chars::GuestIndices::new(_component)?;
116+
let _instance_type = instance_type;
117+
let interface0 = exports::foo::foo::chars::GuestIndices::new(
118+
_component,
119+
_instance_type,
120+
)?;
113121
Ok(TheWorldIndices { interface0 })
114122
}
115123
/// Creates a new instance of [`TheWorldIndices`] from an
@@ -124,6 +132,7 @@ const _: () = {
124132
instance: &wasmtime::component::Instance,
125133
) -> wasmtime::Result<Self> {
126134
let _instance = instance;
135+
let _instance_type = _instance.instance_type(&mut store);
127136
let interface0 = exports::foo::foo::chars::GuestIndices::new_instance(
128137
&mut store,
129138
_instance,
@@ -163,7 +172,7 @@ const _: () = {
163172
instance: &wasmtime::component::Instance,
164173
) -> wasmtime::Result<TheWorld> {
165174
let indices = TheWorldIndices::new_instance(&mut store, instance)?;
166-
indices.load(store, instance)
175+
indices.load(&mut store, instance)
167176
}
168177
pub fn add_to_linker<T, U>(
169178
linker: &mut wasmtime::component::Linker<T>,
@@ -281,6 +290,7 @@ pub mod exports {
281290
/// within a component.
282291
pub fn new(
283292
component: &wasmtime::component::Component,
293+
instance_type: &wasmtime::component::__internal::InstanceType,
284294
) -> wasmtime::Result<GuestIndices> {
285295
let instance = component
286296
.get_export_index(None, "foo:foo/chars")
@@ -289,9 +299,10 @@ pub mod exports {
289299
"no exported instance named `foo:foo/chars`"
290300
)
291301
})?;
292-
Self::_new(|name| {
293-
component.get_export_index(Some(&instance), name)
294-
})
302+
Self::_new(
303+
instance_type,
304+
|name| component.get_export_index(Some(&instance), name),
305+
)
295306
}
296307
/// This constructor is similar to [`GuestIndices::new`] except that it
297308
/// performs string lookups after instantiation time.
@@ -306,12 +317,17 @@ pub mod exports {
306317
"no exported instance named `foo:foo/chars`"
307318
)
308319
})?;
309-
Self::_new(|name| {
310-
instance
311-
.get_export_index(&mut store, Some(&instance_export), name)
312-
})
320+
let instance_type = instance.instance_type(&mut store);
321+
Self::_new(
322+
&instance_type,
323+
|name| {
324+
instance
325+
.get_export_index(&mut store, Some(&instance_export), name)
326+
},
327+
)
313328
}
314329
fn _new(
330+
_instance_type: &wasmtime::component::__internal::InstanceType,
315331
mut lookup: impl FnMut(
316332
&str,
317333
) -> Option<wasmtime::component::ComponentExportIndex>,
@@ -341,6 +357,7 @@ pub mod exports {
341357
let mut store = store.as_context_mut();
342358
let _ = &mut store;
343359
let _instance = instance;
360+
let _instance_type = _instance.instance_type(&mut store);
344361
let take_char = *_instance
345362
.get_typed_func::<(char,), ()>(&mut store, &self.take_char)?
346363
.func();

crates/component-macro/tests/expanded/char_async.rs

+27-10
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ impl<_T> TheWorldPre<_T> {
2727
pub fn new(
2828
instance_pre: wasmtime::component::InstancePre<_T>,
2929
) -> wasmtime::Result<Self> {
30-
let indices = TheWorldIndices::new(instance_pre.component())?;
30+
let indices = TheWorldIndices::new(
31+
instance_pre.component(),
32+
instance_pre.instance_type(),
33+
)?;
3134
Ok(Self { instance_pre, indices })
3235
}
3336
pub fn engine(&self) -> &wasmtime::Engine {
@@ -110,9 +113,14 @@ const _: () = {
110113
/// required exports.
111114
pub fn new(
112115
component: &wasmtime::component::Component,
116+
instance_type: &wasmtime::component::__internal::InstanceType,
113117
) -> wasmtime::Result<Self> {
114118
let _component = component;
115-
let interface0 = exports::foo::foo::chars::GuestIndices::new(_component)?;
119+
let _instance_type = instance_type;
120+
let interface0 = exports::foo::foo::chars::GuestIndices::new(
121+
_component,
122+
_instance_type,
123+
)?;
116124
Ok(TheWorldIndices { interface0 })
117125
}
118126
/// Creates a new instance of [`TheWorldIndices`] from an
@@ -127,6 +135,7 @@ const _: () = {
127135
instance: &wasmtime::component::Instance,
128136
) -> wasmtime::Result<Self> {
129137
let _instance = instance;
138+
let _instance_type = _instance.instance_type(&mut store);
130139
let interface0 = exports::foo::foo::chars::GuestIndices::new_instance(
131140
&mut store,
132141
_instance,
@@ -169,7 +178,7 @@ const _: () = {
169178
instance: &wasmtime::component::Instance,
170179
) -> wasmtime::Result<TheWorld> {
171180
let indices = TheWorldIndices::new_instance(&mut store, instance)?;
172-
indices.load(store, instance)
181+
indices.load(&mut store, instance)
173182
}
174183
pub fn add_to_linker<T, U>(
175184
linker: &mut wasmtime::component::Linker<T>,
@@ -297,6 +306,7 @@ pub mod exports {
297306
/// within a component.
298307
pub fn new(
299308
component: &wasmtime::component::Component,
309+
instance_type: &wasmtime::component::__internal::InstanceType,
300310
) -> wasmtime::Result<GuestIndices> {
301311
let instance = component
302312
.get_export_index(None, "foo:foo/chars")
@@ -305,9 +315,10 @@ pub mod exports {
305315
"no exported instance named `foo:foo/chars`"
306316
)
307317
})?;
308-
Self::_new(|name| {
309-
component.get_export_index(Some(&instance), name)
310-
})
318+
Self::_new(
319+
instance_type,
320+
|name| component.get_export_index(Some(&instance), name),
321+
)
311322
}
312323
/// This constructor is similar to [`GuestIndices::new`] except that it
313324
/// performs string lookups after instantiation time.
@@ -322,12 +333,17 @@ pub mod exports {
322333
"no exported instance named `foo:foo/chars`"
323334
)
324335
})?;
325-
Self::_new(|name| {
326-
instance
327-
.get_export_index(&mut store, Some(&instance_export), name)
328-
})
336+
let instance_type = instance.instance_type(&mut store);
337+
Self::_new(
338+
&instance_type,
339+
|name| {
340+
instance
341+
.get_export_index(&mut store, Some(&instance_export), name)
342+
},
343+
)
329344
}
330345
fn _new(
346+
_instance_type: &wasmtime::component::__internal::InstanceType,
331347
mut lookup: impl FnMut(
332348
&str,
333349
) -> Option<wasmtime::component::ComponentExportIndex>,
@@ -357,6 +373,7 @@ pub mod exports {
357373
let mut store = store.as_context_mut();
358374
let _ = &mut store;
359375
let _instance = instance;
376+
let _instance_type = _instance.instance_type(&mut store);
360377
let take_char = *_instance
361378
.get_typed_func::<(char,), ()>(&mut store, &self.take_char)?
362379
.func();

crates/component-macro/tests/expanded/char_concurrent.rs

+27-10
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ impl<_T> TheWorldPre<_T> {
2727
pub fn new(
2828
instance_pre: wasmtime::component::InstancePre<_T>,
2929
) -> wasmtime::Result<Self> {
30-
let indices = TheWorldIndices::new(instance_pre.component())?;
30+
let indices = TheWorldIndices::new(
31+
instance_pre.component(),
32+
instance_pre.instance_type(),
33+
)?;
3134
Ok(Self { instance_pre, indices })
3235
}
3336
pub fn engine(&self) -> &wasmtime::Engine {
@@ -110,9 +113,14 @@ const _: () = {
110113
/// required exports.
111114
pub fn new(
112115
component: &wasmtime::component::Component,
116+
instance_type: &wasmtime::component::__internal::InstanceType,
113117
) -> wasmtime::Result<Self> {
114118
let _component = component;
115-
let interface0 = exports::foo::foo::chars::GuestIndices::new(_component)?;
119+
let _instance_type = instance_type;
120+
let interface0 = exports::foo::foo::chars::GuestIndices::new(
121+
_component,
122+
_instance_type,
123+
)?;
116124
Ok(TheWorldIndices { interface0 })
117125
}
118126
/// Creates a new instance of [`TheWorldIndices`] from an
@@ -127,6 +135,7 @@ const _: () = {
127135
instance: &wasmtime::component::Instance,
128136
) -> wasmtime::Result<Self> {
129137
let _instance = instance;
138+
let _instance_type = _instance.instance_type(&mut store);
130139
let interface0 = exports::foo::foo::chars::GuestIndices::new_instance(
131140
&mut store,
132141
_instance,
@@ -169,7 +178,7 @@ const _: () = {
169178
instance: &wasmtime::component::Instance,
170179
) -> wasmtime::Result<TheWorld> {
171180
let indices = TheWorldIndices::new_instance(&mut store, instance)?;
172-
indices.load(store, instance)
181+
indices.load(&mut store, instance)
173182
}
174183
pub fn add_to_linker<T, U>(
175184
linker: &mut wasmtime::component::Linker<T>,
@@ -374,6 +383,7 @@ pub mod exports {
374383
/// within a component.
375384
pub fn new(
376385
component: &wasmtime::component::Component,
386+
instance_type: &wasmtime::component::__internal::InstanceType,
377387
) -> wasmtime::Result<GuestIndices> {
378388
let instance = component
379389
.get_export_index(None, "foo:foo/chars")
@@ -382,9 +392,10 @@ pub mod exports {
382392
"no exported instance named `foo:foo/chars`"
383393
)
384394
})?;
385-
Self::_new(|name| {
386-
component.get_export_index(Some(&instance), name)
387-
})
395+
Self::_new(
396+
instance_type,
397+
|name| component.get_export_index(Some(&instance), name),
398+
)
388399
}
389400
/// This constructor is similar to [`GuestIndices::new`] except that it
390401
/// performs string lookups after instantiation time.
@@ -399,12 +410,17 @@ pub mod exports {
399410
"no exported instance named `foo:foo/chars`"
400411
)
401412
})?;
402-
Self::_new(|name| {
403-
instance
404-
.get_export_index(&mut store, Some(&instance_export), name)
405-
})
413+
let instance_type = instance.instance_type(&mut store);
414+
Self::_new(
415+
&instance_type,
416+
|name| {
417+
instance
418+
.get_export_index(&mut store, Some(&instance_export), name)
419+
},
420+
)
406421
}
407422
fn _new(
423+
_instance_type: &wasmtime::component::__internal::InstanceType,
408424
mut lookup: impl FnMut(
409425
&str,
410426
) -> Option<wasmtime::component::ComponentExportIndex>,
@@ -434,6 +450,7 @@ pub mod exports {
434450
let mut store = store.as_context_mut();
435451
let _ = &mut store;
436452
let _instance = instance;
453+
let _instance_type = _instance.instance_type(&mut store);
437454
let take_char = *_instance
438455
.get_typed_func::<(char,), ()>(&mut store, &self.take_char)?
439456
.func();

crates/component-macro/tests/expanded/char_tracing_async.rs

+27-10
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ impl<_T> TheWorldPre<_T> {
2727
pub fn new(
2828
instance_pre: wasmtime::component::InstancePre<_T>,
2929
) -> wasmtime::Result<Self> {
30-
let indices = TheWorldIndices::new(instance_pre.component())?;
30+
let indices = TheWorldIndices::new(
31+
instance_pre.component(),
32+
instance_pre.instance_type(),
33+
)?;
3134
Ok(Self { instance_pre, indices })
3235
}
3336
pub fn engine(&self) -> &wasmtime::Engine {
@@ -110,9 +113,14 @@ const _: () = {
110113
/// required exports.
111114
pub fn new(
112115
component: &wasmtime::component::Component,
116+
instance_type: &wasmtime::component::__internal::InstanceType,
113117
) -> wasmtime::Result<Self> {
114118
let _component = component;
115-
let interface0 = exports::foo::foo::chars::GuestIndices::new(_component)?;
119+
let _instance_type = instance_type;
120+
let interface0 = exports::foo::foo::chars::GuestIndices::new(
121+
_component,
122+
_instance_type,
123+
)?;
116124
Ok(TheWorldIndices { interface0 })
117125
}
118126
/// Creates a new instance of [`TheWorldIndices`] from an
@@ -127,6 +135,7 @@ const _: () = {
127135
instance: &wasmtime::component::Instance,
128136
) -> wasmtime::Result<Self> {
129137
let _instance = instance;
138+
let _instance_type = _instance.instance_type(&mut store);
130139
let interface0 = exports::foo::foo::chars::GuestIndices::new_instance(
131140
&mut store,
132141
_instance,
@@ -169,7 +178,7 @@ const _: () = {
169178
instance: &wasmtime::component::Instance,
170179
) -> wasmtime::Result<TheWorld> {
171180
let indices = TheWorldIndices::new_instance(&mut store, instance)?;
172-
indices.load(store, instance)
181+
indices.load(&mut store, instance)
173182
}
174183
pub fn add_to_linker<T, U>(
175184
linker: &mut wasmtime::component::Linker<T>,
@@ -326,6 +335,7 @@ pub mod exports {
326335
/// within a component.
327336
pub fn new(
328337
component: &wasmtime::component::Component,
338+
instance_type: &wasmtime::component::__internal::InstanceType,
329339
) -> wasmtime::Result<GuestIndices> {
330340
let instance = component
331341
.get_export_index(None, "foo:foo/chars")
@@ -334,9 +344,10 @@ pub mod exports {
334344
"no exported instance named `foo:foo/chars`"
335345
)
336346
})?;
337-
Self::_new(|name| {
338-
component.get_export_index(Some(&instance), name)
339-
})
347+
Self::_new(
348+
instance_type,
349+
|name| component.get_export_index(Some(&instance), name),
350+
)
340351
}
341352
/// This constructor is similar to [`GuestIndices::new`] except that it
342353
/// performs string lookups after instantiation time.
@@ -351,12 +362,17 @@ pub mod exports {
351362
"no exported instance named `foo:foo/chars`"
352363
)
353364
})?;
354-
Self::_new(|name| {
355-
instance
356-
.get_export_index(&mut store, Some(&instance_export), name)
357-
})
365+
let instance_type = instance.instance_type(&mut store);
366+
Self::_new(
367+
&instance_type,
368+
|name| {
369+
instance
370+
.get_export_index(&mut store, Some(&instance_export), name)
371+
},
372+
)
358373
}
359374
fn _new(
375+
_instance_type: &wasmtime::component::__internal::InstanceType,
360376
mut lookup: impl FnMut(
361377
&str,
362378
) -> Option<wasmtime::component::ComponentExportIndex>,
@@ -386,6 +402,7 @@ pub mod exports {
386402
let mut store = store.as_context_mut();
387403
let _ = &mut store;
388404
let _instance = instance;
405+
let _instance_type = _instance.instance_type(&mut store);
389406
let take_char = *_instance
390407
.get_typed_func::<(char,), ()>(&mut store, &self.take_char)?
391408
.func();

0 commit comments

Comments
 (0)