1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-29 19:24:58 +02:00

Handler::handle uses &self instead of mutabble reference

This commit is contained in:
Nikolay Kim
2018-06-21 17:07:54 +06:00
parent 5a9992736f
commit 3de9284592
12 changed files with 57 additions and 50 deletions

View File

@ -126,14 +126,14 @@ pub trait HttpHandler: 'static {
type Task: HttpHandlerTask;
/// Handle request
fn handle(&mut self, req: HttpRequest) -> Result<Self::Task, HttpRequest>;
fn handle(&self, req: HttpRequest) -> Result<Self::Task, HttpRequest>;
}
impl HttpHandler for Box<HttpHandler<Task = Box<HttpHandlerTask>>> {
type Task = Box<HttpHandlerTask>;
fn handle(&mut self, req: HttpRequest) -> Result<Box<HttpHandlerTask>, HttpRequest> {
self.as_mut().handle(req)
fn handle(&self, req: HttpRequest) -> Result<Box<HttpHandlerTask>, HttpRequest> {
self.as_ref().handle(req)
}
}