aboutsummaryrefslogtreecommitdiff
path: root/core/src/async_util/sleep.rs
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/async_util/sleep.rs')
-rw-r--r--core/src/async_util/sleep.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/src/async_util/sleep.rs b/core/src/async_util/sleep.rs
new file mode 100644
index 0000000..f72b825
--- /dev/null
+++ b/core/src/async_util/sleep.rs
@@ -0,0 +1,6 @@
+pub async fn sleep(duration: std::time::Duration) {
+ #[cfg(feature = "smol")]
+ smol::Timer::after(duration).await;
+ #[cfg(feature = "tokio")]
+ tokio::time::sleep(duration).await;
+}