Skip to content
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
2 changes: 1 addition & 1 deletion crates/guest-rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ pub mod rt;
#[cfg(feature = "inter-task-wakeup")]
pub use rt::async_support::UnitStreamOps;
#[cfg(feature = "async-spawn")]
pub use rt::async_support::spawn;
pub use rt::async_support::spawn_local;
#[cfg(feature = "async")]
pub use rt::async_support::{
AbiBuffer, FutureOps, FutureRead, FutureReader, FutureWrite, FutureWriteCancel,
Expand Down
2 changes: 1 addition & 1 deletion crates/guest-rust/src/rt/async_support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ type BoxFuture<'a> = Pin<Box<dyn Future<Output = ()> + 'a>>;
#[cfg(feature = "async-spawn")]
mod spawn;
#[cfg(feature = "async-spawn")]
pub use spawn::spawn;
pub use spawn::spawn_local;
#[cfg(not(feature = "async-spawn"))]
mod spawn_disabled;
#[cfg(not(feature = "async-spawn"))]
Expand Down
2 changes: 1 addition & 1 deletion crates/guest-rust/src/rt/async_support/spawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,6 @@ impl<'a> Tasks<'a> {
///
/// [`block_on`]: crate::block_on
/// [#1305]: https://github.com/bytecodealliance/wit-bindgen/issues/1305
pub fn spawn(future: impl Future<Output = ()> + 'static) {
pub fn spawn_local(future: impl Future<Output = ()> + 'static) {
unsafe { SPAWNED.push(Box::pin(future)) }
}
2 changes: 1 addition & 1 deletion tests/runtime-async/async/ping-pong/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ impl crate::exports::my::test::i::Guest for Component {
async fn ping(x: FutureReader<String>, y: String) -> FutureReader<String> {
let msg = x.await + y.as_str();
let (tx, rx) = wit_future::new(|| unreachable!());
wit_bindgen::spawn(async move {
wit_bindgen::spawn_local(async move {
tx.write(msg).await.unwrap();
});
rx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ static mut HIT: bool = false;

impl crate::exports::test::common::i_runner::Guest for Component {
async fn f() {
wit_bindgen::spawn(async move {
wit_bindgen::spawn_local(async move {
f().await;
unsafe {
HIT = true;
Expand Down
Loading