aboutsummaryrefslogtreecommitdiff
path: root/core/src/async_runtime/mod.rs
blob: d91d01bb0973716091edbe94628d7267fa4961fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
mod executor;
pub mod io;
pub mod lock;
pub mod net;
mod spawn;
mod task;
mod timer;

pub use executor::{global_executor, Executor};
pub use spawn::spawn;
pub use task::Task;

#[cfg(test)]
pub fn block_on<T>(future: impl std::future::Future<Output = T>) -> T {
    #[cfg(feature = "smol")]
    let result = smol::block_on(future);
    #[cfg(feature = "tokio")]
    let result = tokio::runtime::Builder::new_current_thread()
        .enable_all()
        .build()
        .unwrap()
        .block_on(future);

    result
}