1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-12-04 20:31:55 +01:00

fix formatting

This commit is contained in:
Nikolay Kim 2019-05-04 22:18:59 -07:00
parent 33b4c05557
commit a17ff492a1

View File

@ -97,7 +97,7 @@
instead of instead of
```rust ```rust
fn index(req: &HttpRequest) -> Box<Future<Item=HttpResponse, Error=Error>> { fn index(req: &HttpRequest) -> Box<Future<Item=HttpResponse, Error=Error>> {
req req
.payload() .payload()
.from_err() .from_err()
@ -106,21 +106,21 @@ fn index(req: &HttpRequest) -> Box<Future<Item=HttpResponse, Error=Error>> {
}) })
.map(|_| HttpResponse::Ok().finish()) .map(|_| HttpResponse::Ok().finish())
.responder() .responder()
} }
``` ```
use `Payload` extractor use `Payload` extractor
```rust ```rust
fn index(stream: web::Payload) -> impl Future<Item=HttpResponse, Error=Error> { fn index(stream: web::Payload) -> impl Future<Item=HttpResponse, Error=Error> {
stream stream
.from_err() .from_err()
.fold((), |_, chunk| { .fold((), |_, chunk| {
... ...
}) })
.map(|_| HttpResponse::Ok().finish()) .map(|_| HttpResponse::Ok().finish())
} }
``` ```
* `State` is now `Data`. You register Data during the App initialization process * `State` is now `Data`. You register Data during the App initialization process
and then access it from handlers either using a Data extractor or using and then access it from handlers either using a Data extractor or using