Skip to content

Commit

Permalink
update wit-bindgen and simplify async_borrowing_callee test
Browse files Browse the repository at this point in the history
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
  • Loading branch information
dicej committed Jan 15, 2025
1 parent e13563e commit 53f076f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions crates/test-programs/src/bin/async_borrowing_callee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod bindings {
"local:local/borrowing#foo",
"local:local/run-bool#run"
]
}
},
});

use super::Component;
Expand All @@ -19,23 +19,20 @@ use {
exports::local::local::{borrowing::Guest as Borrowing, run_bool::Guest as RunBool},
local::local::borrowing_types::X,
},
futures::future,
std::future::Future,
wit_bindgen_rt::async_support,
};

struct Component;

impl Borrowing for Component {
fn foo(x: &X, misbehave: bool) -> impl Future<Output = ()> + 'static {
async fn foo(x: &X, misbehave: bool) {
let handle = x.handle();
async_support::spawn(async move {
if misbehave {
unsafe { X::from_handle(handle) }.foo();
}
});
x.foo();
future::ready(())
}
}

Expand Down

0 comments on commit 53f076f

Please sign in to comment.