mirror of
https://github.com/actix/actix-website
synced 2025-06-29 08:14:58 +02:00
Final fixes before requesting review.
This commit is contained in:
@ -43,7 +43,7 @@ as the first application, it would match all incoming requests.
|
||||
## State
|
||||
|
||||
Application state is shared with all routes and resources within the same scope. State
|
||||
can be accessed with `web::Data<State>` as read-only, but interior mutability with
|
||||
can be accessed with the `web::Data<State>` extractor as read-only, but interior mutability with
|
||||
`Cell` can be used to achieve state mutability. State is also available for route
|
||||
matching guards and middlewares.
|
||||
|
||||
|
@ -40,7 +40,7 @@ converted into an `HttpInternalServerError`:
|
||||
```rust
|
||||
use std::io;
|
||||
|
||||
fn index(req: &HttpRequest) -> io::Result<fs::NamedFile> {
|
||||
fn index(_req: HttpRequest) -> io::Result<fs::NamedFile> {
|
||||
Ok(fs::NamedFile::open("static/index.html")?)
|
||||
}
|
||||
```
|
||||
|
@ -22,13 +22,13 @@ such as `&'static str`, `String`, etc.
|
||||
Examples of valid handlers:
|
||||
|
||||
```rust
|
||||
fn index(req: &HttpRequest) -> &'static str {
|
||||
fn index(_req: HttpRequest) -> &'static str {
|
||||
"Hello world!"
|
||||
}
|
||||
```
|
||||
|
||||
```rust
|
||||
fn index(req: HttpRequest) -> String {
|
||||
fn index(_req: HttpRequest) -> String {
|
||||
"Hello world!".to_owned()
|
||||
}
|
||||
```
|
||||
@ -37,7 +37,7 @@ You can also change the signature to return `impl Responder` which works well if
|
||||
complex types are involved.
|
||||
|
||||
```rust
|
||||
fn index(req: HttpRequest) -> impl Responder {
|
||||
fn index(_req: HttpRequest) -> impl Responder {
|
||||
Bytes::from_static("Hello world!")
|
||||
}
|
||||
```
|
||||
|
@ -49,9 +49,7 @@ is decompressed.
|
||||
|
||||
# Multipart body
|
||||
|
||||
Actix provides multipart stream support with an external crate, [`actix-multipart`][multipartcrate].
|
||||
|
||||
The following demonstrates multipart stream handling for a simple form:
|
||||
Actix-web provides multipart stream support with an external crate, [`actix-multipart`][multipartcrate].
|
||||
|
||||
> A full example is available in the [examples directory][multipartexample].
|
||||
|
||||
|
@ -83,7 +83,7 @@ against a URL path pattern. `path` represents the path portion of the URL that w
|
||||
The way that *actix-web* does this is very simple. When a request enters the system,
|
||||
for each resource configuration declaration present in the system, actix checks
|
||||
the request's path against the pattern declared. This checking happens in the order that
|
||||
the routes were declared via `App::resource()` method. If resource can not be found,
|
||||
the routes were declared via `App::service()` method. If resource can not be found,
|
||||
the *default resource* is used as the matched resource.
|
||||
|
||||
When a route configuration is declared, it may contain route guard arguments. All route
|
||||
|
Reference in New Issue
Block a user