From 56ae565688739649f27d35866058433361a29a3c Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Mon, 26 Feb 2018 08:02:58 -0800 Subject: [PATCH] fix guide examples --- guide/src/qs_7.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/guide/src/qs_7.md b/guide/src/qs_7.md index 81990361e..2b063f57c 100644 --- a/guide/src/qs_7.md +++ b/guide/src/qs_7.md @@ -106,10 +106,10 @@ use futures::{Future, Stream}; #[derive(Serialize, Deserialize)] struct MyObj {name: String, number: i32} -fn index(mut req: HttpRequest) -> Box> { +fn index(req: HttpRequest) -> Box> { // `concat2` will asynchronously read each chunk of the request body and // return a single, concatenated, chunk - req.payload_mut().concat2() + req.concat2() // `Future::from_err` acts like `?` in that it coerces the error type from // the future into the final error type .from_err() @@ -170,12 +170,14 @@ Enabling chunked encoding for *HTTP/2.0* responses is forbidden. ```rust # extern crate actix_web; +# extern crate futures; +# use futures::Stream; use actix_web::*; fn index(req: HttpRequest) -> HttpResponse { HttpResponse::Ok() .chunked() - .body(Body::Streaming(payload::Payload::empty().stream())).unwrap() + .body(Body::Streaming(Box::new(payload::Payload::empty().from_err()))).unwrap() } # fn main() {} ```