mirror of https://github.com/fafhrd91/actix-web
deprecate App::data
This commit is contained in:
parent
f81d4bdae7
commit
43c193ca18
|
@ -3,8 +3,10 @@
|
||||||
## Unreleased - 2021-xx-xx
|
## Unreleased - 2021-xx-xx
|
||||||
### Changed
|
### Changed
|
||||||
* Change compression algorithm features flags. [#2250]
|
* Change compression algorithm features flags. [#2250]
|
||||||
|
* Deprecate `App::data` and `App::data_factory`. [#????]
|
||||||
|
|
||||||
[#2250]: https://github.com/actix/actix-web/pull/2250
|
[#2250]: https://github.com/actix/actix-web/pull/2250
|
||||||
|
[#????]: https://github.com/actix/actix-web/pull/????
|
||||||
|
|
||||||
|
|
||||||
## 4.0.0-beta.7 - 2021-06-17
|
## 4.0.0-beta.7 - 2021-06-17
|
||||||
|
|
11
src/app.rs
11
src/app.rs
|
@ -98,13 +98,18 @@ where
|
||||||
/// web::resource("/index.html").route(
|
/// web::resource("/index.html").route(
|
||||||
/// web::get().to(index)));
|
/// web::get().to(index)));
|
||||||
/// ```
|
/// ```
|
||||||
|
#[deprecated(since = "4.0.0", note = "Use `.app_data(Data::new(val))` instead.")]
|
||||||
pub fn data<U: 'static>(self, data: U) -> Self {
|
pub fn data<U: 'static>(self, data: U) -> Self {
|
||||||
self.app_data(Data::new(data))
|
self.app_data(Data::new(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set application data factory. This function is
|
/// Add application data factory. This function is similar to `.data()` but it accepts a
|
||||||
/// similar to `.data()` but it accepts data factory. Data object get
|
/// "data factory". Data values are constructed asynchronously during application
|
||||||
/// constructed asynchronously during application initialization.
|
/// initialization, before the server starts accepting requests.
|
||||||
|
#[deprecated(
|
||||||
|
since = "4.0.0",
|
||||||
|
note = "Construct data value before starting server and use `.app_data(Data::new(val))` instead."
|
||||||
|
)]
|
||||||
pub fn data_factory<F, Out, D, E>(mut self, data: F) -> Self
|
pub fn data_factory<F, Out, D, E>(mut self, data: F) -> Self
|
||||||
where
|
where
|
||||||
F: Fn() -> Out + 'static,
|
F: Fn() -> Out + 'static,
|
||||||
|
|
Loading…
Reference in New Issue