1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-01-31 09:12:08 +01:00

add impl Service for Rc<RefCell<S>>

This commit is contained in:
Nikolay Kim 2019-03-29 10:21:17 -07:00
parent 1441355d4f
commit feac0b43d9
2 changed files with 26 additions and 0 deletions

View File

@ -1,5 +1,12 @@
# Changes
## [0.3.5] - 2019-04-xx
### Added
* Add `impl<S: Service> Service for Rc<RefCell<S>>`
## [0.3.4] - 2019-03-12
### Added

View File

@ -1,3 +1,4 @@
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::Arc;
@ -391,6 +392,24 @@ where
}
}
impl<S> Service for Rc<RefCell<S>>
where
S: Service,
{
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.borrow_mut().poll_ready()
}
fn call(&mut self, request: Self::Request) -> S::Future {
self.borrow_mut().call(request)
}
}
impl<S, C> NewService<C> for Rc<S>
where
S: NewService<C>,