async-rs / async-std

Async version of the Rust standard library

Home Page:https://async.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add `FutureExt::wait`

yoshuawuyts opened this issue · comments

commented

Ref: smol-rs/async-task#16

Design Sketch

trait FutureExt: Future {
    /// Wait for the `Future` to complete execution.
    pub fn wait(self) -> <Self as Future>::Output;
}
commented

Rationale here: smol-rs/async-task#16 (comment), but after having researched it further I no longer think this is a good idea. Instead if we want to optimize specific sync variants of futures we should be able to provide specializations for those futures in thread::block_on.