Skip to content

Commit

Permalink
simplify block_on
Browse files Browse the repository at this point in the history
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
  • Loading branch information
Keruspe committed Oct 19, 2020
1 parent 8997a42 commit f8bd46f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ pub use async_executor::Task;
mod reactor {
pub(crate) fn block_on<F: std::future::Future<Output = T>, T>(future: F) -> T {
#[cfg(feature = "async-io")]
use async_io::block_on;
let run = || async_io::block_on(future);
#[cfg(not(feature = "async-io"))]
use future::block_on;
let run = || block_on(future);
let run = || future::block_on(future);
#[cfg(feature = "tokio02")]
let run = || crate::TOKIO02.enter(|| run());
#[cfg(feature = "tokio03")]
Expand Down

0 comments on commit f8bd46f

Please sign in to comment.