diff options
Diffstat (limited to 'third_party/rust/tokio-0.1.22/src/async_await.rs')
-rw-r--r-- | third_party/rust/tokio-0.1.22/src/async_await.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/third_party/rust/tokio-0.1.22/src/async_await.rs b/third_party/rust/tokio-0.1.22/src/async_await.rs new file mode 100644 index 0000000000..ed8b52d073 --- /dev/null +++ b/third_party/rust/tokio-0.1.22/src/async_await.rs @@ -0,0 +1,17 @@ +use tokio_futures::compat; + +/// Like `tokio::run`, but takes an `async` block +pub fn run_async<F>(future: F) +where + F: std::future::Future<Output = ()> + Send + 'static, +{ + ::run(compat::infallible_into_01(future)); +} + +/// Like `tokio::spawn`, but takes an `async` block +pub fn spawn_async<F>(future: F) +where + F: std::future::Future<Output = ()> + Send + 'static, +{ + ::spawn(compat::infallible_into_01(future)); +} |