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:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user