Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add async example to bindgen_examples #9822

Merged
merged 5 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/component-macro/tests/expanded/char.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ pub mod foo {
#[allow(clippy::all)]
pub mod chars {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
pub trait Host {
/// A function that accepts a character
fn take_char(&mut self, x: char) -> ();
Expand Down Expand Up @@ -258,7 +258,7 @@ pub mod exports {
#[allow(clippy::all)]
pub mod chars {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
pub struct Guest {
take_char: wasmtime::component::Func,
return_char: wasmtime::component::Func,
Expand Down
4 changes: 2 additions & 2 deletions crates/component-macro/tests/expanded/char_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ pub mod foo {
#[allow(clippy::all)]
pub mod chars {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[wasmtime::component::__internal::trait_variant_make(::core::marker::Send)]
pub trait Host: Send {
/// A function that accepts a character
Expand Down Expand Up @@ -274,7 +274,7 @@ pub mod exports {
#[allow(clippy::all)]
pub mod chars {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
pub struct Guest {
take_char: wasmtime::component::Func,
return_char: wasmtime::component::Func,
Expand Down
4 changes: 2 additions & 2 deletions crates/component-macro/tests/expanded/char_tracing_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ pub mod foo {
#[allow(clippy::all)]
pub mod chars {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[wasmtime::component::__internal::trait_variant_make(::core::marker::Send)]
pub trait Host: Send {
/// A function that accepts a character
Expand Down Expand Up @@ -303,7 +303,7 @@ pub mod exports {
#[allow(clippy::all)]
pub mod chars {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
pub struct Guest {
take_char: wasmtime::component::Func,
return_char: wasmtime::component::Func,
Expand Down
4 changes: 2 additions & 2 deletions crates/component-macro/tests/expanded/conventions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ pub mod foo {
#[allow(clippy::all)]
pub mod conventions {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
Expand Down Expand Up @@ -420,7 +420,7 @@ pub mod exports {
#[allow(clippy::all)]
pub mod conventions {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
Expand Down
4 changes: 2 additions & 2 deletions crates/component-macro/tests/expanded/conventions_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ pub mod foo {
#[allow(clippy::all)]
pub mod conventions {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
Expand Down Expand Up @@ -456,7 +456,7 @@ pub mod exports {
#[allow(clippy::all)]
pub mod conventions {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ pub mod foo {
#[allow(clippy::all)]
pub mod conventions {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
Expand Down Expand Up @@ -616,7 +616,7 @@ pub mod exports {
#[allow(clippy::all)]
pub mod conventions {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
Expand Down
4 changes: 2 additions & 2 deletions crates/component-macro/tests/expanded/dead-code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ pub mod a {
#[allow(clippy::all)]
pub mod interface_with_live_type {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
Expand Down Expand Up @@ -243,7 +243,7 @@ pub mod a {
#[allow(clippy::all)]
pub mod interface_with_dead_type {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
pub trait Host {}
pub trait GetHost<
T,
Expand Down
4 changes: 2 additions & 2 deletions crates/component-macro/tests/expanded/dead-code_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ pub mod a {
#[allow(clippy::all)]
pub mod interface_with_live_type {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
Expand Down Expand Up @@ -257,7 +257,7 @@ pub mod a {
#[allow(clippy::all)]
pub mod interface_with_dead_type {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[wasmtime::component::__internal::trait_variant_make(::core::marker::Send)]
pub trait Host: Send {}
pub trait GetHost<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ pub mod a {
#[allow(clippy::all)]
pub mod interface_with_live_type {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
Expand Down Expand Up @@ -270,7 +270,7 @@ pub mod a {
#[allow(clippy::all)]
pub mod interface_with_dead_type {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[wasmtime::component::__internal::trait_variant_make(::core::marker::Send)]
pub trait Host: Send {}
pub trait GetHost<
Expand Down
4 changes: 2 additions & 2 deletions crates/component-macro/tests/expanded/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ pub mod foo {
#[allow(clippy::all)]
pub mod flegs {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
wasmtime::component::flags!(Flag1 { #[component(name = "b0")] const B0; });
const _: () = {
assert!(1 == < Flag1 as wasmtime::component::ComponentType >::SIZE32);
Expand Down Expand Up @@ -446,7 +446,7 @@ pub mod exports {
#[allow(clippy::all)]
pub mod flegs {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
wasmtime::component::flags!(
Flag1 { #[component(name = "b0")] const B0; }
);
Expand Down
4 changes: 2 additions & 2 deletions crates/component-macro/tests/expanded/flags_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ pub mod foo {
#[allow(clippy::all)]
pub mod flegs {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
wasmtime::component::flags!(Flag1 { #[component(name = "b0")] const B0; });
const _: () = {
assert!(1 == < Flag1 as wasmtime::component::ComponentType >::SIZE32);
Expand Down Expand Up @@ -472,7 +472,7 @@ pub mod exports {
#[allow(clippy::all)]
pub mod flegs {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
wasmtime::component::flags!(
Flag1 { #[component(name = "b0")] const B0; }
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ pub mod foo {
#[allow(clippy::all)]
pub mod flegs {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
wasmtime::component::flags!(Flag1 { #[component(name = "b0")] const B0; });
const _: () = {
assert!(1 == < Flag1 as wasmtime::component::ComponentType >::SIZE32);
Expand Down Expand Up @@ -584,7 +584,7 @@ pub mod exports {
#[allow(clippy::all)]
pub mod flegs {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
wasmtime::component::flags!(
Flag1 { #[component(name = "b0")] const B0; }
);
Expand Down
4 changes: 2 additions & 2 deletions crates/component-macro/tests/expanded/floats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ pub mod foo {
#[allow(clippy::all)]
pub mod floats {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
pub trait Host {
fn f32_param(&mut self, x: f32) -> ();
fn f64_param(&mut self, x: f64) -> ();
Expand Down Expand Up @@ -275,7 +275,7 @@ pub mod exports {
#[allow(clippy::all)]
pub mod floats {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
pub struct Guest {
f32_param: wasmtime::component::Func,
f64_param: wasmtime::component::Func,
Expand Down
4 changes: 2 additions & 2 deletions crates/component-macro/tests/expanded/floats_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ pub mod foo {
#[allow(clippy::all)]
pub mod floats {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[wasmtime::component::__internal::trait_variant_make(::core::marker::Send)]
pub trait Host: Send {
async fn f32_param(&mut self, x: f32) -> ();
Expand Down Expand Up @@ -295,7 +295,7 @@ pub mod exports {
#[allow(clippy::all)]
pub mod floats {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
pub struct Guest {
f32_param: wasmtime::component::Func,
f64_param: wasmtime::component::Func,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ pub mod foo {
#[allow(clippy::all)]
pub mod floats {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[wasmtime::component::__internal::trait_variant_make(::core::marker::Send)]
pub trait Host: Send {
async fn f32_param(&mut self, x: f32) -> ();
Expand Down Expand Up @@ -353,7 +353,7 @@ pub mod exports {
#[allow(clippy::all)]
pub mod floats {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
pub struct Guest {
f32_param: wasmtime::component::Func,
f64_param: wasmtime::component::Func,
Expand Down
4 changes: 2 additions & 2 deletions crates/component-macro/tests/expanded/integers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ pub mod foo {
#[allow(clippy::all)]
pub mod integers {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
pub trait Host {
fn a1(&mut self, x: u8) -> ();
fn a2(&mut self, x: i8) -> ();
Expand Down Expand Up @@ -485,7 +485,7 @@ pub mod exports {
#[allow(clippy::all)]
pub mod integers {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
pub struct Guest {
a1: wasmtime::component::Func,
a2: wasmtime::component::Func,
Expand Down
4 changes: 2 additions & 2 deletions crates/component-macro/tests/expanded/integers_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ pub mod foo {
#[allow(clippy::all)]
pub mod integers {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[wasmtime::component::__internal::trait_variant_make(::core::marker::Send)]
pub trait Host: Send {
async fn a1(&mut self, x: u8) -> ();
Expand Down Expand Up @@ -534,7 +534,7 @@ pub mod exports {
#[allow(clippy::all)]
pub mod integers {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
pub struct Guest {
a1: wasmtime::component::Func,
a2: wasmtime::component::Func,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ pub mod foo {
#[allow(clippy::all)]
pub mod integers {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[wasmtime::component::__internal::trait_variant_make(::core::marker::Send)]
pub trait Host: Send {
async fn a1(&mut self, x: u8) -> ();
Expand Down Expand Up @@ -799,7 +799,7 @@ pub mod exports {
#[allow(clippy::all)]
pub mod integers {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
pub struct Guest {
a1: wasmtime::component::Func,
a2: wasmtime::component::Func,
Expand Down
4 changes: 2 additions & 2 deletions crates/component-macro/tests/expanded/lists.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ pub mod foo {
#[allow(clippy::all)]
pub mod lists {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
Expand Down Expand Up @@ -963,7 +963,7 @@ pub mod exports {
#[allow(clippy::all)]
pub mod lists {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
Expand Down
4 changes: 2 additions & 2 deletions crates/component-macro/tests/expanded/lists_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ pub mod foo {
#[allow(clippy::all)]
pub mod lists {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
Expand Down Expand Up @@ -1073,7 +1073,7 @@ pub mod exports {
#[allow(clippy::all)]
pub mod lists {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ pub mod foo {
#[allow(clippy::all)]
pub mod lists {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
Expand Down Expand Up @@ -1504,7 +1504,7 @@ pub mod exports {
#[allow(clippy::all)]
pub mod lists {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
Expand Down
4 changes: 2 additions & 2 deletions crates/component-macro/tests/expanded/many-arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ pub mod foo {
#[allow(clippy::all)]
pub mod manyarg {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
Expand Down Expand Up @@ -444,7 +444,7 @@ pub mod exports {
#[allow(clippy::all)]
pub mod manyarg {
#[allow(unused_imports)]
use wasmtime::component::__internal::anyhow;
use wasmtime::component::__internal::{anyhow, Box};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
Expand Down
Loading
Loading