rename handler to handlerservice

This commit is contained in:
ibraheemdev 2020-12-25 14:50:25 -05:00
parent ecf08d5156
commit a59dd6d86e
2 changed files with 10 additions and 10 deletions

View File

@ -36,7 +36,7 @@ where
#[doc(hidden)] #[doc(hidden)]
/// Extract arguments from request, run factory function and make response. /// Extract arguments from request, run factory function and make response.
pub struct Handler<F, T, R, O> pub struct HandlerService<F, T, R, O>
where where
F: Factory<T, R, O>, F: Factory<T, R, O>,
T: FromRequest, T: FromRequest,
@ -47,7 +47,7 @@ where
_t: PhantomData<(T, R, O)>, _t: PhantomData<(T, R, O)>,
} }
impl<F, T, R, O> Handler<F, T, R, O> impl<F, T, R, O> HandlerService<F, T, R, O>
where where
F: Factory<T, R, O>, F: Factory<T, R, O>,
T: FromRequest, T: FromRequest,
@ -55,14 +55,14 @@ where
O: Responder, O: Responder,
{ {
pub fn new(hnd: F) -> Self { pub fn new(hnd: F) -> Self {
Handler { Self {
hnd, hnd,
_t: PhantomData, _t: PhantomData,
} }
} }
} }
impl<F, T, R, O> Clone for Handler<F, T, R, O> impl<F, T, R, O> Clone for HandlerService<F, T, R, O>
where where
F: Factory<T, R, O>, F: Factory<T, R, O>,
T: FromRequest, T: FromRequest,
@ -70,14 +70,14 @@ where
O: Responder, O: Responder,
{ {
fn clone(&self) -> Self { fn clone(&self) -> Self {
Handler { Self {
hnd: self.hnd.clone(), hnd: self.hnd.clone(),
_t: PhantomData, _t: PhantomData,
} }
} }
} }
impl<F, T, R, O> ServiceFactory for Handler<F, T, R, O> impl<F, T, R, O> ServiceFactory for HandlerService<F, T, R, O>
where where
F: Factory<T, R, O>, F: Factory<T, R, O>,
T: FromRequest, T: FromRequest,
@ -98,7 +98,7 @@ where
} }
// Handler is both it's ServiceFactory and Service Type. // Handler is both it's ServiceFactory and Service Type.
impl<F, T, R, O> Service for Handler<F, T, R, O> impl<F, T, R, O> Service for HandlerService<F, T, R, O>
where where
F: Factory<T, R, O>, F: Factory<T, R, O>,
T: FromRequest, T: FromRequest,

View File

@ -11,7 +11,7 @@ use futures_util::future::{ready, FutureExt, LocalBoxFuture};
use crate::extract::FromRequest; use crate::extract::FromRequest;
use crate::guard::{self, Guard}; use crate::guard::{self, Guard};
use crate::handler::{Factory, Handler}; use crate::handler::{Factory, HandlerService};
use crate::responder::Responder; use crate::responder::Responder;
use crate::service::{ServiceRequest, ServiceResponse}; use crate::service::{ServiceRequest, ServiceResponse};
use crate::HttpResponse; use crate::HttpResponse;
@ -51,7 +51,7 @@ impl Route {
#[allow(clippy::new_without_default)] #[allow(clippy::new_without_default)]
pub fn new() -> Route { pub fn new() -> Route {
Route { Route {
service: Box::new(RouteNewService::new(Handler::new(|| { service: Box::new(RouteNewService::new(HandlerService::new(|| {
ready(HttpResponse::NotFound()) ready(HttpResponse::NotFound())
}))), }))),
guards: Rc::new(Vec::new()), guards: Rc::new(Vec::new()),
@ -226,7 +226,7 @@ impl Route {
R: Future<Output = U> + 'static, R: Future<Output = U> + 'static,
U: Responder + 'static, U: Responder + 'static,
{ {
self.service = Box::new(RouteNewService::new(Handler::new(handler))); self.service = Box::new(RouteNewService::new(HandlerService::new(handler)));
self self
} }
} }