mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-30 18:44:35 +01:00
update migration
This commit is contained in:
parent
ee33f52736
commit
32ac159ba2
32
MIGRATION.md
32
MIGRATION.md
@ -44,6 +44,38 @@ registration via `.service()` method.
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* `.with()`, `.with_async()` registration methods have been renamed to `.to()` and `.to_async()`.
|
||||||
|
|
||||||
|
instead of
|
||||||
|
|
||||||
|
```rust
|
||||||
|
App.new().resource("/welcome", |r| r.with(welcome))
|
||||||
|
```
|
||||||
|
|
||||||
|
use `.to()` or `.to_async()` methods
|
||||||
|
|
||||||
|
```rust
|
||||||
|
App.new().service(web::resource("/welcome").to(welcome))
|
||||||
|
```
|
||||||
|
|
||||||
|
* Passing arguments to handler with extractors, multiple arguments are allowed
|
||||||
|
|
||||||
|
instead of
|
||||||
|
|
||||||
|
```rust
|
||||||
|
fn welcome((body, req): (Bytes, HttpRequest)) -> ... {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
use multiple arguments
|
||||||
|
|
||||||
|
```rust
|
||||||
|
fn welcome(body: Bytes, req: HttpRequest) -> ... {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
* `.f()`, `.a()` and `.h()` handler registration methods have been removed.
|
* `.f()`, `.a()` and `.h()` handler registration methods have been removed.
|
||||||
Use `.to()` for handlers and `.to_async()` for async handlers. Handler function
|
Use `.to()` for handlers and `.to_async()` for async handlers. Handler function
|
||||||
must use extractors.
|
must use extractors.
|
||||||
|
Loading…
Reference in New Issue
Block a user