async-await: fix examples (#1050)

* Fix crate path in `Cargo.toml` of examples
* Add `edition2018` to examples in the documentation to make it compiled
  on Rust 2018
* Fix an example in the documentation
This commit is contained in:
Taiki Endo
2019-04-16 14:19:38 -04:00
committed by David Barsky
parent 5029e80a89
commit 88b942652c
3 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -25,14 +25,14 @@ name = "hyper"
path = "src/hyper.rs"
[dependencies]
tokio = { version = "0.1.0", path = "../..", features = ["async-await-preview"] }
tokio = { version = "0.1.18", features = ["async-await-preview"] }
futures = "0.1.23"
bytes = "0.4.9"
hyper = "0.12.8"
# Avoid using crates.io for Tokio dependencies
[patch.crates-io]
tokio = { path = "../.." }
tokio = { path = "../../tokio" }
tokio-async-await = { path = "../" }
tokio-codec = { path = "../../tokio-codec" }
tokio-current-thread = { path = "../../tokio-current-thread" }
+6 -6
View File
@@ -24,7 +24,7 @@ pub trait AsyncReadExt: AsyncRead {
///
/// # Examples
///
/// ```
/// ```edition2018
/// #![feature(async_await, await_macro, futures_api)]
/// tokio::run_async(async {
/// // The extension trait can also be imported with
@@ -58,7 +58,7 @@ pub trait AsyncReadExt: AsyncRead {
///
/// # Examples
///
/// ```
/// ```edition2018
/// #![feature(async_await, await_macro, futures_api)]
/// tokio::run_async(async {
/// // The extension trait can also be imported with
@@ -77,7 +77,7 @@ pub trait AsyncReadExt: AsyncRead {
///
/// ## EOF is hit before `buf` is filled
///
/// ```
/// ```edition2018
/// #![feature(async_await, await_macro, futures_api)]
/// tokio::run_async(async {
/// // The extension trait can also be imported with
@@ -109,7 +109,7 @@ pub trait AsyncWriteExt: AsyncWrite {
///
/// # Examples
///
/// ```
/// ```edition2018
/// #![feature(async_await, await_macro, futures_api)]
/// tokio::run_async(async {
/// // The extension trait can also be imported with
@@ -138,7 +138,7 @@ pub trait AsyncWriteExt: AsyncWrite {
///
/// # Examples
///
/// ```
/// ```edition2018
/// #![feature(async_await, await_macro, futures_api)]
/// tokio::run_async(async {
/// // The extension trait can also be imported with
@@ -162,7 +162,7 @@ pub trait AsyncWriteExt: AsyncWrite {
///
/// # Examples
///
/// ```
/// ```edition2018
/// #![feature(async_await, await_macro, futures_api)]
/// tokio::run_async(async {
/// // The extension trait can also be imported with
+3 -3
View File
@@ -12,12 +12,12 @@ pub trait StreamExt: Stream {
///
/// # Examples
///
/// ```
/// #![feature(await_macro, async_await)]
/// ```edition2018
/// #![feature(await_macro, async_await, futures_api)]
/// tokio::run_async(async {
/// // The extension trait can also be imported with
/// // `use tokio::prelude::*`.
/// use tokio::prelude::{stream, StreamExt};
/// use tokio::prelude::{stream, StreamAsyncExt};
///
/// let mut stream = stream::iter_ok::<_, ()>(1..3);
///