diff --git a/src/lib.rs b/src/lib.rs index c3b8ac8..b2b3b5c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -210,47 +210,6 @@ impl NewService for Rc { } } -/// A service implemented by a closure. -pub struct FnService { - f: F, - _ty: PhantomData R>, // don't impose Sync on R -} - -/// Returns a `Service` backed by the given closure. -pub fn fn_service(f: F) -> FnService - where F: Fn(R) -> S, - S: IntoFuture, -{ - FnService::new(f) -} - -impl FnService - where F: Fn(R) -> S, - S: IntoFuture, -{ - /// Create and return a new `FnService` backed by the given function. - pub fn new(f: F) -> FnService { - FnService { - f: f, - _ty: PhantomData, - } - } -} - -impl Service for FnService - where F: Fn(R) -> S, - S: IntoFuture -{ - type Request = R; - type Response = S::Item; - type Error = S::Error; - type Future = S::Future; - - fn call(&self, req: R) -> Self::Future { - (self.f)(req).into_future() - } -} - impl Service for Box { type Request = S::Request; type Response = S::Response;