| 1 | pub(crate) fn block_on<F: std::future::Future<Output = T>, T>(future: F) -> T { |
| 2 | #[cfg (feature = "async-io" )] |
| 3 | let run: impl FnOnce() -> T = || async_io::block_on(future); |
| 4 | #[cfg (not(feature = "async-io" ))] |
| 5 | let run = || futures_lite::future::block_on(future); |
| 6 | #[cfg (feature = "tokio" )] |
| 7 | let _tokio_enter = crate::tokio::enter(); |
| 8 | #[cfg (feature = "tokio02" )] |
| 9 | let run = || crate::tokio02::enter(run); |
| 10 | #[cfg (feature = "tokio03" )] |
| 11 | let _tokio03_enter = crate::tokio03::enter(); |
| 12 | run() |
| 13 | } |
| 14 | |