From 0f064c43e9bca0a04ad3d249ee535a55293662c2 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Fri, 8 Mar 2019 20:10:47 -0800 Subject: [PATCH] remove uneeded code --- actix-server-config/src/lib.rs | 55 ---------------------------------- 1 file changed, 55 deletions(-) diff --git a/actix-server-config/src/lib.rs b/actix-server-config/src/lib.rs index 6a1b3437..51accad1 100644 --- a/actix-server-config/src/lib.rs +++ b/actix-server-config/src/lib.rs @@ -1,11 +1,7 @@ use std::cell::Cell; -use std::marker::PhantomData; use std::net::SocketAddr; use std::rc::Rc; -use actix_service::{FnService, IntoService, NewService}; -use futures::future::{ok, FutureResult, IntoFuture}; - #[derive(Debug, Clone)] pub struct ServerConfig { addr: SocketAddr, @@ -35,54 +31,3 @@ impl ServerConfig { self.secure.as_ref().set(true) } } - -pub fn server_fn(f: F) -> impl NewService -where - F: Fn(&ServerConfig) -> U + Clone + 'static, - U: FnMut(Req) -> Out + Clone + 'static, - Out: IntoFuture, -{ - ServerFnNewService { f, _t: PhantomData } -} - -struct ServerFnNewService -where - F: Fn(&ServerConfig) -> U + Clone + 'static, - U: FnMut(Req) -> Out + Clone + 'static, - Out: IntoFuture, -{ - f: F, - _t: PhantomData<(U, Req, Out)>, -} - -impl NewService for ServerFnNewService -where - F: Fn(&ServerConfig) -> U + Clone + 'static, - U: FnMut(Req) -> Out + Clone + 'static, - Out: IntoFuture, -{ - type Response = Out::Item; - type Error = Out::Error; - type Service = FnService; - - type InitError = (); - type Future = FutureResult; - - fn new_service(&self, cfg: &ServerConfig) -> Self::Future { - ok((self.f)(cfg).into_service()) - } -} - -impl Clone for ServerFnNewService -where - F: Fn(&ServerConfig) -> U + Clone + 'static, - U: FnMut(Req) -> Out + Clone, - Out: IntoFuture, -{ - fn clone(&self) -> Self { - Self { - f: self.f.clone(), - _t: PhantomData, - } - } -}