1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-08-31 10:46:58 +02:00

remove pin-project; update Unpin consrtaint

This commit is contained in:
Nikolay Kim
2019-11-18 18:28:54 +06:00
parent 7404d82a9b
commit 1354946460
22 changed files with 225 additions and 161 deletions

View File

@@ -8,16 +8,7 @@ pub enum MappedConfig<'a, T> {
}
/// Adapt external config to a config for provided new service
pub fn map_config<T, F, C>(
factory: T,
f: F,
) -> impl ServiceFactory<
Config = C,
Request = T::Request,
Response = T::Response,
Error = T::Error,
InitError = T::InitError,
>
pub fn map_config<T, F, C>(factory: T, f: F) -> MapConfig<T, F, C>
where
T: ServiceFactory,
F: Fn(&C) -> MappedConfig<T::Config>,
@@ -26,23 +17,15 @@ where
}
/// Replace config with unit
pub fn unit_config<T, C>(
new_service: T,
) -> impl ServiceFactory<
Config = C,
Request = T::Request,
Response = T::Response,
Error = T::Error,
InitError = T::InitError,
>
pub fn unit_config<T, C>(new_service: T) -> UnitConfig<T, C>
where
T: ServiceFactory<Config = ()>,
{
UnitConfig::new(new_service)
}
/// `MapInitErr` service combinator
pub(crate) struct MapConfig<A, F, C> {
/// `.map_config()` service combinator
pub struct MapConfig<A, F, C> {
a: A,
f: F,
e: PhantomData<C>,
@@ -50,7 +33,7 @@ pub(crate) struct MapConfig<A, F, C> {
impl<A, F, C> MapConfig<A, F, C> {
/// Create new `MapConfig` combinator
pub fn new(a: A, f: F) -> Self
pub(crate) fn new(a: A, f: F) -> Self
where
A: ServiceFactory,
F: Fn(&C) -> MappedConfig<A::Config>,
@@ -99,8 +82,8 @@ where
}
}
/// `MapInitErr` service combinator
pub(crate) struct UnitConfig<A, C> {
/// `unit_config()` config combinator
pub struct UnitConfig<A, C> {
a: A,
e: PhantomData<C>,
}