-
Notifications
You must be signed in to change notification settings - Fork 91
/
mod.rs
24 lines (21 loc) · 642 Bytes
/
mod.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Helper functions to be runtime agnostic
#[cfg(feature = "tokio-runtime")]
extern crate tokio;
#[allow(unused_imports)]
#[cfg(feature = "tokio-runtime")]
pub use tokio::{main, test};
#[cfg(feature = "async-std-runtime")]
extern crate async_std;
#[allow(unused_imports)]
#[cfg(feature = "async-std-runtime")]
pub use async_std::{main, test};
#[allow(unused)]
#[cfg(feature = "tokio-runtime")]
pub async fn sleep(duration: std::time::Duration) {
tokio::time::sleep(duration).await
}
#[allow(unused)]
#[cfg(feature = "async-std-runtime")]
pub async fn sleep(duration: std::time::Duration) {
async_std::task::sleep(duration).await
}