1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-08-26 10:14:48 +02:00

make service Request type generic

This commit is contained in:
Nikolay Kim
2019-03-05 07:35:26 -08:00
parent e8a49801eb
commit dfbb77f98d
34 changed files with 622 additions and 747 deletions

View File

@@ -13,9 +13,9 @@ pub struct CloneableService<T: 'static> {
}
impl<T: 'static> CloneableService<T> {
pub fn new(service: T) -> Self
pub fn new<R>(service: T) -> Self
where
T: Service,
T: Service<R>,
{
Self {
service: Cell::new(service),
@@ -33,11 +33,10 @@ impl<T: 'static> Clone for CloneableService<T> {
}
}
impl<T> Service for CloneableService<T>
impl<T, R> Service<R> for CloneableService<T>
where
T: Service + 'static,
T: Service<R> + 'static,
{
type Request = T::Request;
type Response = T::Response;
type Error = T::Error;
type Future = T::Future;
@@ -46,7 +45,7 @@ where
self.service.get_mut().poll_ready()
}
fn call(&mut self, req: T::Request) -> Self::Future {
fn call(&mut self, req: R) -> Self::Future {
self.service.get_mut().call(req)
}
}