From 8bf8ad86d6efaf6874b445c026d393b15f7105a4 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Mon, 18 Nov 2019 20:46:49 +0600 Subject: [PATCH] add IntoServiceFactory impl for servie_fn --- actix-service/src/fn_service.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/actix-service/src/fn_service.rs b/actix-service/src/fn_service.rs index ad82c9c9..693d7f48 100644 --- a/actix-service/src/fn_service.rs +++ b/actix-service/src/fn_service.rs @@ -152,6 +152,17 @@ where } } +impl + IntoServiceFactory> for F +where + F: Fn(Req) -> Fut + Clone, + Fut: Future>, +{ + fn into_factory(self) -> FnServiceFactory { + FnServiceFactory::new(self) + } +} + /// Convert `Fn(&Config) -> Future` fn to NewService pub struct FnServiceConfig where