1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-22 13:45:13 +02:00

use read only self for Middleware

This commit is contained in:
Nikolay Kim
2018-06-21 23:06:23 +06:00
parent 3de9284592
commit 65ca563579
18 changed files with 150 additions and 173 deletions

View File

@@ -178,7 +178,7 @@ impl<T> IdentityService<T> {
struct IdentityBox(Box<Identity>);
impl<S: 'static, T: IdentityPolicy<S>> Middleware<S> for IdentityService<T> {
fn start(&mut self, req: &mut HttpRequest<S>) -> Result<Started> {
fn start(&self, req: &mut HttpRequest<S>) -> Result<Started> {
let mut req = req.clone();
let fut = self
@@ -195,7 +195,7 @@ impl<S: 'static, T: IdentityPolicy<S>> Middleware<S> for IdentityService<T> {
}
fn response(
&mut self, req: &mut HttpRequest<S>, resp: HttpResponse,
&self, req: &mut HttpRequest<S>, resp: HttpResponse,
) -> Result<Response> {
if let Some(mut id) = req.extensions_mut().remove::<IdentityBox>() {
id.0.write(resp)