Add `ServiceConfig::configure`

This commit is contained in:
mibac138 2021-02-13 14:40:51 +01:00
parent 7fa6333a0c
commit d9938d4909
2 changed files with 14 additions and 1 deletions

View File

@ -1,11 +1,13 @@
# Changes # Changes
## Unreleased - 2021-xx-xx ## Unreleased - 2021-xx-xx
### Added
* Added `ServiceConfig::configure` to allow easy nesting of configuration. [#1988]
### Changed ### Changed
* Feature `cookies` is now optional and enabled by default. [#1981] * Feature `cookies` is now optional and enabled by default. [#1981]
[#1981]: https://github.com/actix/actix-web/pull/1981 [#1981]: https://github.com/actix/actix-web/pull/1981
[#1988]: https://github.com/actix/actix-web/pull/1988
## 4.0.0-beta.3 - 2021-02-10 ## 4.0.0-beta.3 - 2021-02-10
* Update `actix-web-codegen` to `0.5.0-beta.1`. * Update `actix-web-codegen` to `0.5.0-beta.1`.

View File

@ -199,6 +199,17 @@ impl ServiceConfig {
self self
} }
/// Run external configuration as part of the application building process
///
/// Counterpart to [`App::configure()`](crate::App::configure) that allows for easy nesting.
pub fn configure<F>(&mut self, f: F) -> &mut Self
where
F: FnOnce(&mut ServiceConfig),
{
f(self);
self
}
/// Configure route for a specific path. /// Configure route for a specific path.
/// ///
/// Counterpart to [`App::route()`](crate::App::route). /// Counterpart to [`App::route()`](crate::App::route).