1 2 3 4 5 6 7 8 9 10 11
use std::time::Duration; pub(crate) async fn sleep(duration: Duration) { cfg_if::cfg_if! { if #[cfg(feature = "tokio")] { tokio::time::sleep(duration).await } else { std::thread::sleep(duration) } } }