1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-27 19:12:56 +01:00

add IntoServiceFactory impl for servie_fn

This commit is contained in:
Nikolay Kim 2019-11-18 20:46:49 +06:00
parent 877f89eeb7
commit 8bf8ad86d6

View File

@ -152,6 +152,17 @@ where
} }
} }
impl<F, Fut, Req, Res, Err, Cfg>
IntoServiceFactory<FnServiceFactory<F, Fut, Req, Res, Err, Cfg>> for F
where
F: Fn(Req) -> Fut + Clone,
Fut: Future<Output = Result<Res, Err>>,
{
fn into_factory(self) -> FnServiceFactory<F, Fut, Req, Res, Err, Cfg> {
FnServiceFactory::new(self)
}
}
/// Convert `Fn(&Config) -> Future<Service>` fn to NewService /// Convert `Fn(&Config) -> Future<Service>` fn to NewService
pub struct FnServiceConfig<F, Fut, Cfg, Srv, Err> pub struct FnServiceConfig<F, Fut, Cfg, Srv, Err>
where where