Skip to content

Commit

Permalink
Use FnMut instead of Fn for FnService
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed Jan 12, 2019
1 parent b5d84bd commit 3169746
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
7 changes: 7 additions & 0 deletions actix-service/CHANGES.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion actix-service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "actix-service"
version = "0.1.3"
version = "0.1.4"
authors = ["Nikolay Kim <[email protected]>"]
description = "Actix Service"
keywords = ["network", "framework", "async", "futures"]
Expand Down
20 changes: 10 additions & 10 deletions actix-service/src/fn_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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;
Expand All @@ -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> {
Expand All @@ -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,
Expand All @@ -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 {
Expand All @@ -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;
Expand All @@ -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> {
Expand All @@ -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 {
Expand Down

0 comments on commit 3169746

Please sign in to comment.