@@ -9,7 +9,7 @@ weight: 170
9
9
Actix-web provides a facility for type-safe request information access called * extractors*
10
10
(ie, ` impl FromRequest ` ). By default, actix-web provides several extractor implementations.
11
11
12
- An extractor can be accessed as an arguments to a handler function. Actix-web supports
12
+ An extractor can be accessed as an argument to a handler function. Actix-web supports
13
13
up to 10 extractors per handler function. Argument position does not matter.
14
14
15
15
{{< include-example example="extractors" file="main.rs" section="option-one" >}}
@@ -19,7 +19,7 @@ up to 10 extractors per handler function. Argument position does not matter.
19
19
[ * Path* ] [ pathstruct ] provides information that can be extracted from the Request's
20
20
path. You can deserialize any variable segment from the path.
21
21
22
- For instance, for resource that registered for the ` /users/{userid}/{friend} ` path
22
+ For instance, for resource that registered for the ` /users/{userid}/{friend} ` path,
23
23
two segments could be deserialized, ` userid ` and ` friend ` . These segments could be
24
24
extracted into a ` tuple ` , i.e. ` Path<(u32, String)> ` or any structure that implements
25
25
the ` Deserialize ` trait from the * serde* crate.
@@ -45,14 +45,14 @@ query parameters. Underneath it uses *serde_urlencoded* crate.
45
45
46
46
# Json
47
47
48
- [ * Json* ] [ jsonstruct ] allows to deserialize a request body into a struct. To extract
48
+ [ * Json* ] [ jsonstruct ] allows deserialization of a request body into a struct. To extract
49
49
typed information from a request's body, the type ` T ` must implement the ` Deserialize `
50
50
trait from * serde* .
51
51
52
52
{{< include-example example="extractors" file="json_one.rs" section="json-one" >}}
53
53
54
54
Some extractors provide a way to configure the extraction process. Json extractor
55
- [ * JsonConfig* ] [ jsonconfig ] type for configuration. To configure an extractor, pass it's
55
+ [ * JsonConfig* ] [ jsonconfig ] type for configuration. To configure an extractor, pass its
56
56
configuration object to the resource's ` .data() ` method. In case of a * Json* extractor
57
57
it returns a * JsonConfig* . You can configure the maximum size of the json payload as
58
58
well as a custom error handler function.
@@ -63,7 +63,7 @@ The following example limits the size of the payload to 4kb and uses a custom er
63
63
64
64
# Form
65
65
66
- At the moment only url-encoded forms are supported. The url-encoded body could be
66
+ At the moment, only url-encoded forms are supported. The url-encoded body could be
67
67
extracted to a specific type. This type must implement the ` Deserialize ` trait from
68
68
the * serde* crate.
69
69
@@ -92,10 +92,8 @@ Application state is accessible from the handler with the `web::Data` extractor;
92
92
however, state is accessible as a read-only reference. If you need mutable access to state,
93
93
it must be implemented.
94
94
95
- > ** Beware** , actix creates multiple copies of the application state and the handlers,
96
- > unique for each thread. If you run your application in several threads, actix will
97
- > create the same amount as number of threads of application state objects and handler
98
- > objects.
95
+ > ** Beware** , actix creates multiple copies of the application state and the handlers. It creates
96
+ > one copy for each thread.
99
97
100
98
Here is an example of a handler that stores the number of processed requests:
101
99
0 commit comments