From 7e6735a04476d9d575a0ab3a34d1d485a331fe8b Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Thu, 30 Dec 2021 16:45:45 +0600 Subject: [PATCH] Remove fn_transform --- ntex-service/CHANGES.md | 6 +++++- ntex-service/src/fn_transform.rs | 25 ------------------------- ntex-service/src/lib.rs | 5 +---- 3 files changed, 6 insertions(+), 30 deletions(-) delete mode 100644 ntex-service/src/fn_transform.rs diff --git a/ntex-service/CHANGES.md b/ntex-service/CHANGES.md index 7f4b5757..ace909bf 100644 --- a/ntex-service/CHANGES.md +++ b/ntex-service/CHANGES.md @@ -1,6 +1,10 @@ # Changes -## [0.3.0] - 2021-12-24 +## [0.3.0] - 2021-12-30 + +* Remove fn_transform + +## [0.3.0-b.0] - 2021-12-24 * Service takes request type as a type parameter instead of an associated type diff --git a/ntex-service/src/fn_transform.rs b/ntex-service/src/fn_transform.rs deleted file mode 100644 index 99fc1196..00000000 --- a/ntex-service/src/fn_transform.rs +++ /dev/null @@ -1,25 +0,0 @@ -use crate::Transform; - -/// Use function as transform service -pub fn fn_transform(f: F) -> FnTransform { - FnTransform(f) -} - -pub struct FnTransform(F); - -impl Transform for FnTransform -where - F: Fn(S) -> Out, -{ - type Service = Out; - - fn new_transform(&self, service: S) -> Self::Service { - (self.0)(service) - } -} - -impl Clone for FnTransform { - fn clone(&self) -> Self { - Self(self.0.clone()) - } -} diff --git a/ntex-service/src/lib.rs b/ntex-service/src/lib.rs index 65d6c0ea..b664f004 100644 --- a/ntex-service/src/lib.rs +++ b/ntex-service/src/lib.rs @@ -9,7 +9,6 @@ mod and_then; mod apply; pub mod boxed; mod fn_service; -//mod fn_transform; mod map; mod map_config; mod map_err; @@ -20,7 +19,6 @@ mod transform; pub use self::apply::{apply_fn, apply_fn_factory}; pub use self::fn_service::{fn_factory, fn_factory_with_config, fn_service}; -// pub use self::fn_transform::fn_transform; pub use self::map_config::{map_config, map_config_service, unit_config}; pub use self::pipeline::{pipeline, pipeline_factory, Pipeline, PipelineFactory}; pub use self::transform::{apply, Identity, Transform}; @@ -324,11 +322,10 @@ pub mod dev { pub use crate::fn_service::{ FnService, FnServiceConfig, FnServiceFactory, FnServiceNoConfig, }; - pub use crate::then::{Then, ThenFactory}; - // pub use crate::fn_transform::FnTransform; pub use crate::map::{Map, MapServiceFactory}; pub use crate::map_config::{MapConfig, UnitConfig}; pub use crate::map_err::{MapErr, MapErrServiceFactory}; pub use crate::map_init_err::MapInitErr; + pub use crate::then::{Then, ThenFactory}; pub use crate::transform::ApplyTransform; }