Remove fn_transform

This commit is contained in:
Nikolay Kim 2021-12-30 16:45:45 +06:00
parent ca72be32e9
commit 7e6735a044
3 changed files with 6 additions and 30 deletions

View file

@ -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

View file

@ -1,25 +0,0 @@
use crate::Transform;
/// Use function as transform service
pub fn fn_transform<F>(f: F) -> FnTransform<F> {
FnTransform(f)
}
pub struct FnTransform<F>(F);
impl<S, F, Out> Transform<S> for FnTransform<F>
where
F: Fn(S) -> Out,
{
type Service = Out;
fn new_transform(&self, service: S) -> Self::Service {
(self.0)(service)
}
}
impl<F: Clone> Clone for FnTransform<F> {
fn clone(&self) -> Self {
Self(self.0.clone())
}
}

View file

@ -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;
}