tycho_util/futures/await_blocking.rs
1pub trait AwaitBlocking: IntoFuture {
2 /// Blocks the current thread polling the future to completion.
3 ///
4 /// DO NOT USE INSIDE ASYNC CONTEXT.
5 fn await_blocking(self) -> <Self as IntoFuture>::Output;
6}
7
8impl<T: IntoFuture> AwaitBlocking for T {
9 fn await_blocking(self) -> <Self as IntoFuture>::Output {
10 futures_executor::block_on(self.into_future())
11 }
12}