mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 16:02:59 +01:00
rename service
This commit is contained in:
parent
3c402a55da
commit
20c693b39c
@ -10,7 +10,7 @@ mod service;
|
|||||||
pub use self::codec::{Codec, InMessage, InMessageType, OutMessage};
|
pub use self::codec::{Codec, InMessage, InMessageType, OutMessage};
|
||||||
pub use self::decoder::{PayloadDecoder, RequestDecoder};
|
pub use self::decoder::{PayloadDecoder, RequestDecoder};
|
||||||
pub use self::dispatcher::Dispatcher;
|
pub use self::dispatcher::Dispatcher;
|
||||||
pub use self::service::{H1Service, H1ServiceHandler, H1SimpleService};
|
pub use self::service::{H1Service, H1ServiceHandler, OneRequest};
|
||||||
|
|
||||||
use request::Request;
|
use request::Request;
|
||||||
|
|
||||||
|
@ -261,23 +261,23 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `NewService` implementation for `H1SimpleServiceHandler` service
|
/// `NewService` implementation for `OneRequestService` service
|
||||||
pub struct H1SimpleService<T> {
|
pub struct OneRequest<T> {
|
||||||
config: ServiceConfig,
|
config: ServiceConfig,
|
||||||
_t: PhantomData<T>,
|
_t: PhantomData<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> H1SimpleService<T> {
|
impl<T> OneRequest<T> {
|
||||||
/// Create new `H1SimpleService` instance.
|
/// Create new `H1SimpleService` instance.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
H1SimpleService {
|
OneRequest {
|
||||||
config: ServiceConfig::default(),
|
config: ServiceConfig::default(),
|
||||||
_t: PhantomData,
|
_t: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> NewService for H1SimpleService<T>
|
impl<T> NewService for OneRequest<T>
|
||||||
where
|
where
|
||||||
T: AsyncRead + AsyncWrite,
|
T: AsyncRead + AsyncWrite,
|
||||||
{
|
{
|
||||||
@ -285,11 +285,11 @@ where
|
|||||||
type Response = (Request, Framed<T, Codec>);
|
type Response = (Request, Framed<T, Codec>);
|
||||||
type Error = ParseError;
|
type Error = ParseError;
|
||||||
type InitError = ();
|
type InitError = ();
|
||||||
type Service = H1SimpleServiceHandler<T>;
|
type Service = OneRequestService<T>;
|
||||||
type Future = FutureResult<Self::Service, Self::InitError>;
|
type Future = FutureResult<Self::Service, Self::InitError>;
|
||||||
|
|
||||||
fn new_service(&self) -> Self::Future {
|
fn new_service(&self) -> Self::Future {
|
||||||
ok(H1SimpleServiceHandler {
|
ok(OneRequestService {
|
||||||
config: self.config.clone(),
|
config: self.config.clone(),
|
||||||
_t: PhantomData,
|
_t: PhantomData,
|
||||||
})
|
})
|
||||||
@ -298,40 +298,40 @@ where
|
|||||||
|
|
||||||
/// `Service` implementation for HTTP1 transport. Reads one request and returns
|
/// `Service` implementation for HTTP1 transport. Reads one request and returns
|
||||||
/// request and framed object.
|
/// request and framed object.
|
||||||
pub struct H1SimpleServiceHandler<T> {
|
pub struct OneRequestService<T> {
|
||||||
config: ServiceConfig,
|
config: ServiceConfig,
|
||||||
_t: PhantomData<T>,
|
_t: PhantomData<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Service for H1SimpleServiceHandler<T>
|
impl<T> Service for OneRequestService<T>
|
||||||
where
|
where
|
||||||
T: AsyncRead + AsyncWrite,
|
T: AsyncRead + AsyncWrite,
|
||||||
{
|
{
|
||||||
type Request = T;
|
type Request = T;
|
||||||
type Response = (Request, Framed<T, Codec>);
|
type Response = (Request, Framed<T, Codec>);
|
||||||
type Error = ParseError;
|
type Error = ParseError;
|
||||||
type Future = H1SimpleServiceHandlerResponse<T>;
|
type Future = OneRequestServiceResponse<T>;
|
||||||
|
|
||||||
fn poll_ready(&mut self) -> Poll<(), Self::Error> {
|
fn poll_ready(&mut self) -> Poll<(), Self::Error> {
|
||||||
Ok(Async::Ready(()))
|
Ok(Async::Ready(()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn call(&mut self, req: Self::Request) -> Self::Future {
|
fn call(&mut self, req: Self::Request) -> Self::Future {
|
||||||
H1SimpleServiceHandlerResponse {
|
OneRequestServiceResponse {
|
||||||
framed: Some(Framed::new(req, Codec::new(self.config.clone()))),
|
framed: Some(Framed::new(req, Codec::new(self.config.clone()))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub struct H1SimpleServiceHandlerResponse<T>
|
pub struct OneRequestServiceResponse<T>
|
||||||
where
|
where
|
||||||
T: AsyncRead + AsyncWrite,
|
T: AsyncRead + AsyncWrite,
|
||||||
{
|
{
|
||||||
framed: Option<Framed<T, Codec>>,
|
framed: Option<Framed<T, Codec>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Future for H1SimpleServiceHandlerResponse<T>
|
impl<T> Future for OneRequestServiceResponse<T>
|
||||||
where
|
where
|
||||||
T: AsyncRead + AsyncWrite,
|
T: AsyncRead + AsyncWrite,
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user