fix tower-service helloworld docs example to use new futures (#346)

This commit is contained in:
Mackenzie Clark 2019-09-15 12:09:58 -07:00 committed by David Barsky
parent ca951d56f4
commit f4a81d2c7d
1 changed files with 4 additions and 4 deletions

View File

@ -40,10 +40,10 @@ use std::task::{Context, Poll};
/// impl Service<http::Request> for HelloWorld { /// impl Service<http::Request> for HelloWorld {
/// type Response = http::Response; /// type Response = http::Response;
/// type Error = http::Error; /// type Error = http::Error;
/// type Future = Box<Future<Output = Result<Self::Response, Self::Error>>>; /// type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>>>>;
/// ///
/// fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<(), Self::Error> { /// fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
/// Ok(Async::Ready(())) /// Poll::Ready(Ok(()))
/// } /// }
/// ///
/// fn call(&mut self, req: http::Request) -> Self::Future { /// fn call(&mut self, req: http::Request) -> Self::Future {
@ -52,7 +52,7 @@ use std::task::{Context, Poll};
/// .with_body(b"hello world\n"); /// .with_body(b"hello world\n");
/// ///
/// // Return the response as an immediate future /// // Return the response as an immediate future
/// Box::new(futures::finished(resp)) /// Box::pin(futures::future::ok(resp))
/// } /// }
/// } /// }
/// ``` /// ```