diff --git a/actix-service/CHANGES.md b/actix-service/CHANGES.md index 1dad989e..4aa8a31b 100644 --- a/actix-service/CHANGES.md +++ b/actix-service/CHANGES.md @@ -1,5 +1,12 @@ # Changes +## [1.0.1] - 2019-12-22 + +### Changed + +* `map_config()` and `unit_config()` accepts `IntoServiceFactory` type + + ## [1.0.0] - 2019-12-11 ### Added diff --git a/actix-service/Cargo.toml b/actix-service/Cargo.toml index 31926c58..cd6507fa 100644 --- a/actix-service/Cargo.toml +++ b/actix-service/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-service" -version = "1.0.0" +version = "1.0.1" authors = ["Nikolay Kim "] description = "Actix service" keywords = ["network", "framework", "async", "futures"] diff --git a/actix-service/src/map_config.rs b/actix-service/src/map_config.rs index 40b27c7d..7a1a1b89 100644 --- a/actix-service/src/map_config.rs +++ b/actix-service/src/map_config.rs @@ -1,28 +1,30 @@ use std::marker::PhantomData; -use super::ServiceFactory; +use super::{IntoServiceFactory, ServiceFactory}; /// Adapt external config argument to a config for provided service factory /// /// Note that this function consumes the receiving service factory and returns /// a wrapped version of it. -pub fn map_config(factory: T, f: F) -> MapConfig +pub fn map_config(factory: U, f: F) -> MapConfig where T: ServiceFactory, + U: IntoServiceFactory, F: Fn(C) -> T::Config, { - MapConfig::new(factory, f) + MapConfig::new(factory.into_factory(), f) } /// Replace config with unit -pub fn unit_config(new_service: T) -> UnitConfig +pub fn unit_config(factory: U) -> UnitConfig where T: ServiceFactory, + U: IntoServiceFactory, { - UnitConfig::new(new_service) + UnitConfig::new(factory.into_factory()) } -/// `.map_config()` service combinator +/// `map_config()` adapter service factory pub struct MapConfig { a: A, f: F,