https://docs.rs/wit-bindgen/0.46.0/wit_bindgen/fn.spawn.html
Defer the specified future to be run after the current async-lifted export task has returned a value.
IIUC this means that the spawning task will deadlock if it waits on something that the spawned task will do, right? That makes sense to me but I wonder if we should name this something other than spawn since you can't use it for things that you would naturally use thread or tokio spawn for. How about defer?
Relatedly, would it make sense to include a basic wit_bindgen::join(fut_a, fut_b)? You can always pull in e.g. futures-lite but this seems fundamental enough that it might be worth including anyway.
The wording here isn't quite right, your situation wouldn't deadlock because it actually progresses both tasks concurrently - needs a doc update
And yeah having some simple future combinators seems reasonable to me
Did this change since 0.46?
I blamed a deadlock on this, just curious if I was mistaken.
nah it's always been the case that spawned tasks progress in parallel with the main task
fun fact: futures-lite doesnt even include join :(
It calls it zip :shrug:
whaaaaaaa
god dammit why did they do that
Last updated: Dec 06 2025 at 05:03 UTC