impl Service for &mut Service (#22)

This commit is contained in:
Sean McArthur 2017-10-25 14:06:27 -07:00 committed by Carl Lerche
parent 4cb50eef77
commit 6c3d8443b5
1 changed files with 15 additions and 0 deletions

View File

@ -287,6 +287,21 @@ impl<S: NewService + ?Sized> NewService for Rc<S> {
}
}
impl<'a, S: Service + 'a> Service for &'a mut S {
type Request = S::Request;
type Response = S::Response;
type Error = S::Error;
type Future = S::Future;
fn poll_ready(&mut self) -> Poll<(), S::Error> {
(**self).poll_ready()
}
fn call(&mut self, request: S::Request) -> S::Future {
(**self).call(request)
}
}
impl<S: Service + ?Sized> Service for Box<S> {
type Request = S::Request;
type Response = S::Response;