From 316974616ac74bf431da34ca783564b2926e74c5 Mon Sep 17 00:00:00 2001
From: Nikolay Kim <fafhrd91@gmail.com>
Date: Fri, 11 Jan 2019 21:39:58 -0800
Subject: [PATCH] Use FnMut instead of Fn for FnService

---
 actix-service/CHANGES.md        |  7 +++++++
 actix-service/Cargo.toml        |  2 +-
 actix-service/src/fn_service.rs | 20 ++++++++++----------
 3 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/actix-service/CHANGES.md b/actix-service/CHANGES.md
index 7817e6ef..9ca2326a 100644
--- a/actix-service/CHANGES.md
+++ b/actix-service/CHANGES.md
@@ -1,5 +1,12 @@
 # Changes
 
+## [0.1.4] - 2019-01-11
+
+## Changed
+
+* Use `FnMut` instead of `Fn` for `FnService`
+
+
 ## [0.1.3] - 2018-12-12
 
 ## Changed
diff --git a/actix-service/Cargo.toml b/actix-service/Cargo.toml
index 49a2ae1a..6a5109a9 100644
--- a/actix-service/Cargo.toml
+++ b/actix-service/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "actix-service"
-version = "0.1.3"
+version = "0.1.4"
 authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
 description = "Actix Service"
 keywords = ["network", "framework", "async", "futures"]
diff --git a/actix-service/src/fn_service.rs b/actix-service/src/fn_service.rs
index d6e19e8a..0726ca78 100644
--- a/actix-service/src/fn_service.rs
+++ b/actix-service/src/fn_service.rs
@@ -9,7 +9,7 @@ use super::{IntoNewService, IntoService, NewService, Service};
 
 pub struct FnService<F, Req, Resp, E, Fut>
 where
-    F: Fn(Req) -> Fut,
+    F: FnMut(Req) -> Fut,
     Fut: IntoFuture<Item = Resp, Error = E>,
 {
     f: F,
@@ -18,7 +18,7 @@ where
 
 impl<F, Req, Resp, E, Fut> FnService<F, Req, Resp, E, Fut>
 where
-    F: Fn(Req) -> Fut,
+    F: FnMut(Req) -> Fut,
     Fut: IntoFuture<Item = Resp, Error = E>,
 {
     pub fn new(f: F) -> Self {
@@ -31,7 +31,7 @@ where
 
 impl<F, Req, Resp, E, Fut> Clone for FnService<F, Req, Resp, E, Fut>
 where
-    F: Fn(Req) -> Fut + Clone,
+    F: FnMut(Req) -> Fut + Clone,
     Fut: IntoFuture<Item = Resp, Error = E>,
 {
     fn clone(&self) -> Self {
@@ -44,7 +44,7 @@ where
 
 impl<F, Req, Resp, E, Fut> Service<Req> for FnService<F, Req, Resp, E, Fut>
 where
-    F: Fn(Req) -> Fut,
+    F: FnMut(Req) -> Fut,
     Fut: IntoFuture<Item = Resp, Error = E>,
 {
     type Response = Resp;
@@ -62,7 +62,7 @@ where
 
 impl<F, Req, Resp, Err, Fut> IntoService<FnService<F, Req, Resp, Err, Fut>, Req> for F
 where
-    F: Fn(Req) -> Fut + 'static,
+    F: FnMut(Req) -> Fut + 'static,
     Fut: IntoFuture<Item = Resp, Error = Err>,
 {
     fn into_service(self) -> FnService<F, Req, Resp, Err, Fut> {
@@ -72,7 +72,7 @@ where
 
 pub struct FnNewService<F, Req, Resp, Err, Fut>
 where
-    F: Fn(Req) -> Fut,
+    F: FnMut(Req) -> Fut,
     Fut: IntoFuture<Item = Resp, Error = Err>,
 {
     f: F,
@@ -81,7 +81,7 @@ where
 
 impl<F, Req, Resp, Err, Fut> FnNewService<F, Req, Resp, Err, Fut>
 where
-    F: Fn(Req) -> Fut + Clone,
+    F: FnMut(Req) -> Fut + Clone,
     Fut: IntoFuture<Item = Resp, Error = Err>,
 {
     pub fn new(f: F) -> Self {
@@ -94,7 +94,7 @@ where
 
 impl<F, Req, Resp, Err, Fut> NewService<Req> for FnNewService<F, Req, Resp, Err, Fut>
 where
-    F: Fn(Req) -> Fut + Clone,
+    F: FnMut(Req) -> Fut + Clone,
     Fut: IntoFuture<Item = Resp, Error = Err>,
 {
     type Response = Resp;
@@ -110,7 +110,7 @@ where
 
 impl<F, Req, Resp, Err, Fut> IntoNewService<FnNewService<F, Req, Resp, Err, Fut>, Req> for F
 where
-    F: Fn(Req) -> Fut + Clone + 'static,
+    F: FnMut(Req) -> Fut + Clone + 'static,
     Fut: IntoFuture<Item = Resp, Error = Err>,
 {
     fn into_new_service(self) -> FnNewService<F, Req, Resp, Err, Fut> {
@@ -120,7 +120,7 @@ where
 
 impl<F, Req, Resp, Err, Fut> Clone for FnNewService<F, Req, Resp, Err, Fut>
 where
-    F: Fn(Req) -> Fut + Clone,
+    F: FnMut(Req) -> Fut + Clone,
     Fut: IntoFuture<Item = Resp, Error = Err>,
 {
     fn clone(&self) -> Self {