1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-19 12:25:37 +02:00

Update Middleware trait to use &mut self

This commit is contained in:
Josh Leeb-du Toit
2018-06-02 13:37:29 +10:00
parent 8d73c30dae
commit 9c9eb62031
15 changed files with 111 additions and 90 deletions

View File

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