From 20c693b39c0e80436cc6c1d0e3641a226f8c8fe1 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Mon, 15 Oct 2018 16:46:13 -0700 Subject: [PATCH] rename service --- src/h1/mod.rs | 2 +- src/h1/service.rs | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/h1/mod.rs b/src/h1/mod.rs index 2a276b7a0..1ac65912e 100644 --- a/src/h1/mod.rs +++ b/src/h1/mod.rs @@ -10,7 +10,7 @@ mod service; pub use self::codec::{Codec, InMessage, InMessageType, OutMessage}; pub use self::decoder::{PayloadDecoder, RequestDecoder}; pub use self::dispatcher::Dispatcher; -pub use self::service::{H1Service, H1ServiceHandler, H1SimpleService}; +pub use self::service::{H1Service, H1ServiceHandler, OneRequest}; use request::Request; diff --git a/src/h1/service.rs b/src/h1/service.rs index bf92e8d2f..404ded6b0 100644 --- a/src/h1/service.rs +++ b/src/h1/service.rs @@ -261,23 +261,23 @@ where } } -/// `NewService` implementation for `H1SimpleServiceHandler` service -pub struct H1SimpleService { +/// `NewService` implementation for `OneRequestService` service +pub struct OneRequest { config: ServiceConfig, _t: PhantomData, } -impl H1SimpleService { +impl OneRequest { /// Create new `H1SimpleService` instance. pub fn new() -> Self { - H1SimpleService { + OneRequest { config: ServiceConfig::default(), _t: PhantomData, } } } -impl NewService for H1SimpleService +impl NewService for OneRequest where T: AsyncRead + AsyncWrite, { @@ -285,11 +285,11 @@ where type Response = (Request, Framed); type Error = ParseError; type InitError = (); - type Service = H1SimpleServiceHandler; + type Service = OneRequestService; type Future = FutureResult; fn new_service(&self) -> Self::Future { - ok(H1SimpleServiceHandler { + ok(OneRequestService { config: self.config.clone(), _t: PhantomData, }) @@ -298,40 +298,40 @@ where /// `Service` implementation for HTTP1 transport. Reads one request and returns /// request and framed object. -pub struct H1SimpleServiceHandler { +pub struct OneRequestService { config: ServiceConfig, _t: PhantomData, } -impl Service for H1SimpleServiceHandler +impl Service for OneRequestService where T: AsyncRead + AsyncWrite, { type Request = T; type Response = (Request, Framed); type Error = ParseError; - type Future = H1SimpleServiceHandlerResponse; + type Future = OneRequestServiceResponse; fn poll_ready(&mut self) -> Poll<(), Self::Error> { Ok(Async::Ready(())) } fn call(&mut self, req: Self::Request) -> Self::Future { - H1SimpleServiceHandlerResponse { + OneRequestServiceResponse { framed: Some(Framed::new(req, Codec::new(self.config.clone()))), } } } #[doc(hidden)] -pub struct H1SimpleServiceHandlerResponse +pub struct OneRequestServiceResponse where T: AsyncRead + AsyncWrite, { framed: Option>, } -impl Future for H1SimpleServiceHandlerResponse +impl Future for OneRequestServiceResponse where T: AsyncRead + AsyncWrite, {