diff --git a/.travis.yml b/.travis.yml index d91bcbb..3e4d109 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: rust rust: - - nightly-2019-04-25 + - nightly-2019-05-09 before_script: | rustup component add rustfmt clippy diff --git a/Cargo.toml b/Cargo.toml index e906500..0de6474 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,4 +18,4 @@ http = "0.1.17" http-service-hyper = { path = "http-service-hyper", version = "0.2.0" } [dependencies.futures-preview] -version = "0.3.0-alpha.15" +version = "0.3.0-alpha.16" diff --git a/README.md b/README.md index 1c7255e..234dec5 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## About -The crate `http-service` provides the necessary types and traits to implement your own HTTP Server. It uses `hyper` for the lower level TCP abstraction. +The crate `http-service` provides the necessary types and traits to implement your own HTTP Server. It uses `hyper` for the lower level TCP abstraction. You can use the workspace member [`http-service-hyper`](https://crates.io/crates/http-service-hyper) to run your HTTP Server. @@ -70,7 +70,7 @@ version = "0.1.1" **main.rs** ```rust -#![feature(futures_api, async_await, await_macro, existential_type)] +#![feature(async_await, existential_type)] use futures::future::{self, FutureObj}; use http_service::{HttpService, Response}; diff --git a/examples/simple_response.rs b/examples/simple_response.rs index 11cdf28..a87b105 100644 --- a/examples/simple_response.rs +++ b/examples/simple_response.rs @@ -1,4 +1,4 @@ -#![feature(async_await, await_macro, existential_type)] +#![feature(async_await, existential_type)] use futures::future::{self, FutureObj}; use http_service::{HttpService, Response}; diff --git a/http-service-hyper/Cargo.toml b/http-service-hyper/Cargo.toml index 5c62994..fb63f71 100644 --- a/http-service-hyper/Cargo.toml +++ b/http-service-hyper/Cargo.toml @@ -18,4 +18,4 @@ hyper = "0.12.27" [dependencies.futures-preview] features = ["compat"] -version = "0.3.0-alpha.15" +version = "0.3.0-alpha.16" diff --git a/http-service-hyper/src/lib.rs b/http-service-hyper/src/lib.rs index 8f9c34d..1c7570a 100644 --- a/http-service-hyper/src/lib.rs +++ b/http-service-hyper/src/lib.rs @@ -4,7 +4,7 @@ #![deny(missing_debug_implementations, nonstandard_style)] #![warn(missing_docs, missing_doc_code_examples)] #![cfg_attr(test, deny(warnings))] -#![feature(async_await, await_macro)] +#![feature(async_await)] use futures::{ compat::{Compat, Compat01As03, Future01CompatExt}, @@ -40,7 +40,7 @@ where let service = self.service.clone(); let error = std::io::Error::from(std::io::ErrorKind::Other); async move { - let connection = await!(service.connect().into_future()).map_err(|_| error)?; + let connection = service.connect().into_future().await.map_err(|_| error)?; Ok(WrapConnection { service, connection, @@ -72,7 +72,7 @@ where let fut = self.service.respond(&mut self.connection, req); async move { - let res: http::Response<_> = await!(fut.into_future()).map_err(|_| error)?; + let res: http::Response<_> = fut.into_future().await.map_err(|_| error)?; Ok(res.map(|body| hyper::Body::wrap_stream(body.compat()))) } .boxed() diff --git a/http-service-mock/Cargo.toml b/http-service-mock/Cargo.toml index 5e0fd2f..dc65824 100644 --- a/http-service-mock/Cargo.toml +++ b/http-service-mock/Cargo.toml @@ -14,4 +14,4 @@ version = "0.2.0" http-service = { version = "0.2.0", path = ".." } [dependencies.futures-preview] -version = "0.3.0-alpha.15" +version = "0.3.0-alpha.16" diff --git a/src/lib.rs b/src/lib.rs index 2eb0f51..cbef153 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,7 @@ //! //! ## Example //! ```no_run, rust, ignore -//! #![feature(futures_api, async_await, await_macro, existential_type)] +//! #![feature(async_await, existential_type)] //! //! use futures::{ //! future::{self, FutureObj}, @@ -57,19 +57,17 @@ #![deny(missing_debug_implementations, nonstandard_style)] #![warn(missing_docs, missing_doc_code_examples)] #![cfg_attr(test, deny(warnings))] -#![feature(async_await, await_macro, arbitrary_self_types)] +#![feature(async_await, arbitrary_self_types)] use bytes::Bytes; use futures::{ future, prelude::*, stream::{self, BoxStream}, - task::Context, - Poll, + task::{Context, Poll}, }; use std::fmt; -use std::marker::Unpin; use std::pin::Pin; /// The raw body of an http request or response. @@ -96,11 +94,10 @@ impl Body { } /// Reads the stream into a new `Vec`. - #[allow(unused_mut)] #[allow(clippy::wrong_self_convention)] // https://github.com/rust-lang/rust-clippy/issues/4037 pub async fn into_vec(mut self) -> std::io::Result> { let mut bytes = Vec::new(); - while let Some(chunk) = await!(self.next()) { + while let Some(chunk) = self.next().await { bytes.extend(chunk?); } Ok(bytes)