1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-30 20:04:26 +02:00

impl HttpHandler for Box<HttpHandler> and add helper method Application::boxed() #49

This commit is contained in:
Nikolay Kim
2018-01-13 18:58:17 -08:00
parent 2b0f3d2a9a
commit 927a92fcac
5 changed files with 52 additions and 5 deletions

View File

@ -54,6 +54,12 @@ pub trait HttpHandler: 'static {
fn handle(&mut self, req: HttpRequest) -> Result<Box<HttpHandlerTask>, HttpRequest>;
}
impl HttpHandler for Box<HttpHandler> {
fn handle(&mut self, req: HttpRequest) -> Result<Box<HttpHandlerTask>, HttpRequest> {
self.as_mut().handle(req)
}
}
pub trait HttpHandlerTask {
fn poll(&mut self) -> Poll<(), Error>;