1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-31 00:50:20 +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

@@ -250,7 +250,7 @@ impl<S, T: SessionBackend<S>> SessionStorage<T, S> {
}
impl<S: 'static, T: SessionBackend<S>> Middleware<S> for SessionStorage<T, S> {
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.0.from_request(&mut req).then(move |res| match res {
@@ -265,7 +265,7 @@ impl<S: 'static, T: SessionBackend<S>> Middleware<S> for SessionStorage<T, S> {
}
fn response(
&self, req: &mut HttpRequest<S>, resp: HttpResponse,
&mut self, req: &mut HttpRequest<S>, resp: HttpResponse,
) -> Result<Response> {
if let Some(s_box) = req.extensions_mut().remove::<Arc<SessionImplCell>>() {
s_box.0.borrow_mut().write(resp)