summaryrefslogtreecommitdiffstats
path: root/tokio-futures/src/async_wait.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tokio-futures/src/async_wait.rs')
-rw-r--r--tokio-futures/src/async_wait.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tokio-futures/src/async_wait.rs b/tokio-futures/src/async_wait.rs
new file mode 100644
index 00000000..e626f99e
--- /dev/null
+++ b/tokio-futures/src/async_wait.rs
@@ -0,0 +1,15 @@
+/// Wait for a future to complete.
+#[macro_export]
+macro_rules! async_wait {
+ ($e:expr) => {{
+ #[allow(unused_imports)]
+ use $crate::compat::backward::IntoAwaitable as IntoAwaitableBackward;
+ #[allow(unused_imports)]
+ use $crate::compat::forward::IntoAwaitable as IntoAwaitableForward;
+
+ #[allow(unused_mut)]
+ let mut e = $e;
+ let e = e.into_awaitable();
+ e.await
+ }};
+}