summaryrefslogtreecommitdiffstats
path: root/tokio-reactor
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2018-08-27 12:24:51 -0700
committerGitHub <noreply@github.com>2018-08-27 12:24:51 -0700
commitb479ce78d3e05f689d2a7c501942d2de67bed722 (patch)
tree487e9b625b713a766b57f7299fee70c24371c272 /tokio-reactor
parent6e45e0ac61b68208310748a61f68dc6df576dbb6 (diff)
add experimental async/await support. (#582)
This patch adds experimental async/await support to Tokio. It does this by adding feature flags to existing libs only where necessary in order to add nightly specific code (mostly `Unpin` implementations). It then provides a new crate: `tokio-async-await` which is a shim layer on top of `tokio`. The `tokio-async-await` crate is expected to look exactly like `tokio` does, but with async / await support. This strategy reduces the amount of cfg guarding in the main libraries. This patch also adds `tokio-channel`, which is copied from futures-rs 0.1 and adds the necessary `Unpin` implementations. In general, futures 0.1 is mostly unmaintained, so it will make sense for Tokio to take over maintainership of key components regardless of async / await support.
Diffstat (limited to 'tokio-reactor')
-rw-r--r--tokio-reactor/CHANGELOG.md4
-rw-r--r--tokio-reactor/Cargo.toml9
-rw-r--r--tokio-reactor/src/async_await.rs5
-rw-r--r--tokio-reactor/src/lib.rs10
4 files changed, 25 insertions, 3 deletions
diff --git a/tokio-reactor/CHANGELOG.md b/tokio-reactor/CHANGELOG.md
index e7bd54d8..344a6928 100644
--- a/tokio-reactor/CHANGELOG.md
+++ b/tokio-reactor/CHANGELOG.md
@@ -1,3 +1,7 @@
+# 0.1.5 (August 27, 2018)
+
+* Experimental async / await support.
+
# 0.1.4 (August 23, 2018)
* Use a scalable RW lock (#517)
diff --git a/tokio-reactor/Cargo.toml b/tokio-reactor/Cargo.toml
index 85901c5d..7861204e 100644
--- a/tokio-reactor/Cargo.toml
+++ b/tokio-reactor/Cargo.toml
@@ -6,18 +6,23 @@ name = "tokio-reactor"
# - Update CHANGELOG.md.
# - Update doc URL.
# - Create "v0.1.x" git tag.
-version = "0.1.4"
+version = "0.1.5"
authors = ["Carl Lerche <me@carllerche.com>"]
license = "MIT"
readme = "README.md"
repository = "https://github.com/tokio-rs/tokio"
homepage = "https://tokio.rs"
-documentation = "https://docs.rs/tokio-reactor/0.1.4/tokio_reactor"
+documentation = "https://docs.rs/tokio-reactor/0.1.5/tokio_reactor"
description = """
Event loop that drives Tokio I/O resources.
"""
categories = ["asynchronous", "network-programming"]
+[features]
+# This feature comes with no promise of stability. Things will break with each
+# patch release. Use at your own risk.
+async-await-preview = []
+
[dependencies]
crossbeam-utils = "0.5.0"
futures = "0.1.19"
diff --git a/tokio-reactor/src/async_await.rs b/tokio-reactor/src/async_await.rs
new file mode 100644
index 00000000..698f285c
--- /dev/null
+++ b/tokio-reactor/src/async_await.rs
@@ -0,0 +1,5 @@
+use Registration;
+
+use std::marker::Unpin;
+
+impl Unpin for Registration {}
diff --git a/tokio-reactor/src/lib.rs b/tokio-reactor/src/lib.rs
index 3dff5782..eeefb7d0 100644
--- a/tokio-reactor/src/lib.rs
+++ b/tokio-reactor/src/lib.rs
@@ -1,5 +1,8 @@
-#![doc(html_root_url = "https://docs.rs/tokio-reactor/0.1.4")]
+#![doc(html_root_url = "https://docs.rs/tokio-reactor/0.1.5")]
#![deny(missing_docs, warnings, missing_debug_implementations)]
+#![cfg_attr(feature = "async-await-preview", feature(
+ pin,
+ ))]
//! Event loop that drives Tokio I/O resources.
//!
@@ -756,3 +759,8 @@ impl Error for SetFallbackError {
"attempted to set fallback reactor while already configured"
}
}
+
+// ===== EXPERIMENTAL async / await support =====
+
+#[cfg(feature = "async-await-preview")]
+mod async_await;