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.
This commit is contained in:
Carl Lerche
2018-08-27 12:24:51 -07:00
committed by GitHub
parent 6e45e0ac61
commit b479ce78d3
42 changed files with 3736 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
use Registration;
use std::marker::Unpin;
impl Unpin for Registration {}
+9 -1
View File
@@ -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;