mirror of
https://github.com/fafhrd91/actix-web
synced 2024-12-04 20:31:55 +01:00
fix formatting
This commit is contained in:
parent
33b4c05557
commit
a17ff492a1
16
MIGRATION.md
16
MIGRATION.md
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user