wit-bindgen icon indicating copy to clipboard operation
wit-bindgen copied to clipboard

rust: Add basic future combinator(s)

Open lann opened this issue 5 months ago • 2 comments

While generic async libraries like futures can be pulled in for a wide variety of features I think it would be helpful to cover at least a couple of the most basic combinators in the wit-bindgen crate itself, e.g. some version of join and select.

lann avatar Oct 13 '25 16:10 lann

Would these combinators be used by the generated bindings themselves? If not, this isn't something I would expect to be included by a low-level bindings generator. A better place to include async concurrency operators would be at a higher-lever bindings layer like wstd, or even the Rust stdblib.

yoshuawuyts avatar Dec 08 '25 14:12 yoshuawuyts

That said though: correct usage of the select! API cannot be guaranteed by the compiler and so should be avoided entirely. Even if you end up choosing to include some concurrency operations as part of the low-level bindings generator, those operations should not include select!. I've written about the problems with select! here in more detail.

yoshuawuyts avatar Dec 08 '25 15:12 yoshuawuyts