Skip to content

Commit

Permalink
refactor(service): change service_fn to take Fn instead of FnMut
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed May 2, 2018
1 parent 190a850 commit 283d79d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//!
//! There are two levels of APIs provide for constructing HTTP servers:
//!
//! - The higher-level [`Server`](Server).
//! - The higher-level [`Server`](Server) type.
//! - The lower-level [conn](conn) module.
//!
//! # Server
Expand Down
8 changes: 4 additions & 4 deletions src/service/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub trait Service {
/// ```
pub fn service_fn<F, R, S>(f: F) -> ServiceFn<F, R>
where
F: FnMut(Request<R>) -> S,
F: Fn(Request<R>) -> S,
S: IntoFuture,
{
ServiceFn {
Expand All @@ -75,7 +75,7 @@ where
/// ```
pub fn service_fn_ok<F, R, S>(f: F) -> ServiceFnOk<F, R>
where
F: FnMut(Request<R>) -> Response<S>,
F: Fn(Request<R>) -> Response<S>,
S: Payload,
{
ServiceFnOk {
Expand All @@ -92,7 +92,7 @@ pub struct ServiceFn<F, R> {

impl<F, ReqBody, Ret, ResBody> Service for ServiceFn<F, ReqBody>
where
F: FnMut(Request<ReqBody>) -> Ret,
F: Fn(Request<ReqBody>) -> Ret,
ReqBody: Payload,
Ret: IntoFuture<Item=Response<ResBody>>,
Ret::Error: Into<Box<StdError + Send + Sync>>,
Expand Down Expand Up @@ -133,7 +133,7 @@ pub struct ServiceFnOk<F, R> {

impl<F, ReqBody, ResBody> Service for ServiceFnOk<F, ReqBody>
where
F: FnMut(Request<ReqBody>) -> Response<ResBody>,
F: Fn(Request<ReqBody>) -> Response<ResBody>,
ReqBody: Payload,
ResBody: Payload,
{
Expand Down

0 comments on commit 283d79d

Please sign in to comment.