Skip to content

Commit

Permalink
Update application.md - set correct State link (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
humb1t committed Mar 25, 2024
1 parent 84c2676 commit 6c6106d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/application.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Any number of state types could be registered within the application.

`HttpServer` accepts an application factory rather than an application instance. An `HttpServer` constructs an application instance for each thread. Therefore, application data must be constructed multiple times. If you want to share data between different threads, a shareable object should be used, e.g. `Send` + `Sync`.

Internally, [`web::types::State`][data] uses `Arc`. So in order to avoid creating two `Arc`s, we should create our data before registering it using [`App::state()`][appstate].
Internally, [`web::types::State`][state] uses `Arc`. So in order to avoid creating two `Arc`s, we should create our data before registering it using [`App::state()`][appstate].

In the following example, we will write an application with mutable, shared state. First, we define our state and create our handler:

Expand Down Expand Up @@ -93,7 +93,7 @@ Each [`ServiceConfig`][serviceconfig] can have its own `state`, `routes`, and `s
[guardtrait]: https://docs.rs/ntex/latest/ntex/web/guard/trait.Guard.html
[guardfuncs]: https://docs.rs/ntex/latest/ntex/web/guard/index.html#functions
[guardheader]: https://docs.rs/ntex/latest/ntex/web/guard/fn.Header.html
[data]: https://docs.rs/ntex/latest/ntex/web/types/struct.State.html
[state]: https://docs.rs/ntex/latest/ntex/web/types/struct.State.html
[app]: https://docs.rs/ntex/latest/ntex/web/struct.App.html
[appconfig]: https://docs.rs/ntex/latest/ntex/web/struct.App.html#method.configure
[appstate]: https://docs.rs/ntex/latest/ntex/web/struct.App.html#method.app_data
Expand Down

0 comments on commit 6c6106d

Please sign in to comment.