Impl Service for Service trait object
This commit is contained in:
parent
4dfeaba1f5
commit
6d7cf21c02
34
src/lib.rs
34
src/lib.rs
|
@ -241,3 +241,37 @@ impl<F, R> Clone for SimpleService<F, R> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T, U, E, F> Service for Box<Service<Request = T, Response = U, Error = E, Future = F>>
|
||||||
|
where F: Future<Item = U, Error = E>
|
||||||
|
{
|
||||||
|
type Request = T;
|
||||||
|
type Response = U;
|
||||||
|
type Error = E;
|
||||||
|
type Future = F;
|
||||||
|
|
||||||
|
fn call(&self, request: T) -> F {
|
||||||
|
(**self).call(request)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn poll_ready(&self) -> Async<()> {
|
||||||
|
(**self).poll_ready()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T, U, E, F> Service for Box<Service<Request = T, Response = U, Error = E, Future = F> + Send + 'static>
|
||||||
|
where F: Future<Item = U, Error = E>
|
||||||
|
{
|
||||||
|
type Request = T;
|
||||||
|
type Response = U;
|
||||||
|
type Error = E;
|
||||||
|
type Future = F;
|
||||||
|
|
||||||
|
fn call(&self, request: T) -> F {
|
||||||
|
(**self).call(request)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn poll_ready(&self) -> Async<()> {
|
||||||
|
(**self).poll_ready()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue