mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-24 00:21:08 +01:00
better doc string for Application::with_state()
This commit is contained in:
parent
a826d113ee
commit
65b8197876
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "actix-web"
|
name = "actix-web"
|
||||||
version = "0.5.2"
|
version = "0.5.3"
|
||||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||||
description = "Actix web is a simple, pragmatic and extremely fast web framework for Rust."
|
description = "Actix web is a simple, pragmatic and extremely fast web framework for Rust."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
@ -177,6 +177,13 @@ where
|
|||||||
///
|
///
|
||||||
/// State is shared with all resources within same application and
|
/// State is shared with all resources within same application and
|
||||||
/// could be accessed with `HttpRequest::state()` method.
|
/// could be accessed with `HttpRequest::state()` method.
|
||||||
|
///
|
||||||
|
/// **Note**: http server accepts an application factory rather than
|
||||||
|
/// an application instance. Http server constructs an application
|
||||||
|
/// instance for each thread, thus application state must be constructed multiple
|
||||||
|
/// times. If you want to share state between different threads, a
|
||||||
|
/// shared object should be used, e.g. `Arc`. Application state does not
|
||||||
|
/// need to be `Send` and `Sync`.
|
||||||
pub fn with_state(state: S) -> App<S> {
|
pub fn with_state(state: S) -> App<S> {
|
||||||
App {
|
App {
|
||||||
parts: Some(ApplicationParts {
|
parts: Some(ApplicationParts {
|
||||||
|
Loading…
Reference in New Issue
Block a user