mirror of
https://github.com/fafhrd91/actix-net
synced 2024-11-24 00:01:11 +01:00
use FnMut instead of Fn
This commit is contained in:
parent
2c8e7c4ae4
commit
278176fca5
@ -2,6 +2,9 @@
|
||||
|
||||
## [0.1.6] - 2019-01-xx
|
||||
|
||||
### Changed
|
||||
|
||||
* Use `FnMut` instead of `Fn` for .apply() and .map() combinators and `FnService` type
|
||||
|
||||
## [0.1.5] - 2019-01-13
|
||||
|
||||
|
@ -78,7 +78,7 @@ where
|
||||
impl<T, F, In, Out, Request> ApplyNewService<T, F, In, Out, Request>
|
||||
where
|
||||
T: NewService<Request>,
|
||||
F: Fn(In, &mut T::Service) -> Out,
|
||||
F: FnMut(In, &mut T::Service) -> Out,
|
||||
Out: IntoFuture,
|
||||
Out::Error: From<T::Error>,
|
||||
{
|
||||
@ -95,7 +95,7 @@ where
|
||||
impl<T, F, In, Out, Request> Clone for ApplyNewService<T, F, In, Out, Request>
|
||||
where
|
||||
T: NewService<Request> + Clone,
|
||||
F: Fn(In, &mut T::Service) -> Out + Clone,
|
||||
F: FnMut(In, &mut T::Service) -> Out + Clone,
|
||||
Out: IntoFuture,
|
||||
{
|
||||
fn clone(&self) -> Self {
|
||||
@ -110,7 +110,7 @@ where
|
||||
impl<T, F, In, Out, Request> NewService<In> for ApplyNewService<T, F, In, Out, Request>
|
||||
where
|
||||
T: NewService<Request>,
|
||||
F: Fn(In, &mut T::Service) -> Out + Clone,
|
||||
F: FnMut(In, &mut T::Service) -> Out + Clone,
|
||||
Out: IntoFuture,
|
||||
Out::Error: From<T::Error>,
|
||||
{
|
||||
@ -129,7 +129,7 @@ where
|
||||
pub struct ApplyNewServiceFuture<T, F, In, Out, Request>
|
||||
where
|
||||
T: NewService<Request>,
|
||||
F: Fn(In, &mut T::Service) -> Out,
|
||||
F: FnMut(In, &mut T::Service) -> Out,
|
||||
Out: IntoFuture,
|
||||
{
|
||||
fut: T::Future,
|
||||
@ -140,7 +140,7 @@ where
|
||||
impl<T, F, In, Out, Request> ApplyNewServiceFuture<T, F, In, Out, Request>
|
||||
where
|
||||
T: NewService<Request>,
|
||||
F: Fn(In, &mut T::Service) -> Out,
|
||||
F: FnMut(In, &mut T::Service) -> Out,
|
||||
Out: IntoFuture,
|
||||
{
|
||||
fn new(fut: T::Future, f: F) -> Self {
|
||||
@ -155,7 +155,7 @@ where
|
||||
impl<T, F, In, Out, Request> Future for ApplyNewServiceFuture<T, F, In, Out, Request>
|
||||
where
|
||||
T: NewService<Request>,
|
||||
F: Fn(In, &mut T::Service) -> Out,
|
||||
F: FnMut(In, &mut T::Service) -> Out,
|
||||
Out: IntoFuture,
|
||||
Out::Error: From<T::Error>,
|
||||
{
|
||||
|
@ -128,7 +128,7 @@ pub trait ServiceExt<Request>: Service<Request> {
|
||||
fn map<F, R>(self, f: F) -> Map<Self, F, R>
|
||||
where
|
||||
Self: Sized,
|
||||
F: Fn(Self::Response) -> R,
|
||||
F: FnMut(Self::Response) -> R,
|
||||
{
|
||||
Map::new(self, f)
|
||||
}
|
||||
@ -245,7 +245,7 @@ pub trait NewService<Request> {
|
||||
fn map<F, R>(self, f: F) -> MapNewService<Self, F, R>
|
||||
where
|
||||
Self: Sized,
|
||||
F: Fn(Self::Response) -> R,
|
||||
F: FnMut(Self::Response) -> R,
|
||||
{
|
||||
MapNewService::new(self, f)
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ impl<A, F, Response> Map<A, F, Response> {
|
||||
pub fn new<Request>(service: A, f: F) -> Self
|
||||
where
|
||||
A: Service<Request>,
|
||||
F: Fn(A::Response) -> Response,
|
||||
F: FnMut(A::Response) -> Response,
|
||||
{
|
||||
Self {
|
||||
service,
|
||||
@ -45,7 +45,7 @@ where
|
||||
impl<A, F, Request, Response> Service<Request> for Map<A, F, Response>
|
||||
where
|
||||
A: Service<Request>,
|
||||
F: Fn(A::Response) -> Response + Clone,
|
||||
F: FnMut(A::Response) -> Response + Clone,
|
||||
{
|
||||
type Response = Response;
|
||||
type Error = A::Error;
|
||||
@ -63,7 +63,7 @@ where
|
||||
pub struct MapFuture<A, F, Request, Response>
|
||||
where
|
||||
A: Service<Request>,
|
||||
F: Fn(A::Response) -> Response,
|
||||
F: FnMut(A::Response) -> Response,
|
||||
{
|
||||
f: F,
|
||||
fut: A::Future,
|
||||
@ -72,7 +72,7 @@ where
|
||||
impl<A, F, Request, Response> MapFuture<A, F, Request, Response>
|
||||
where
|
||||
A: Service<Request>,
|
||||
F: Fn(A::Response) -> Response,
|
||||
F: FnMut(A::Response) -> Response,
|
||||
{
|
||||
fn new(fut: A::Future, f: F) -> Self {
|
||||
MapFuture { f, fut }
|
||||
@ -82,7 +82,7 @@ where
|
||||
impl<A, F, Request, Response> Future for MapFuture<A, F, Request, Response>
|
||||
where
|
||||
A: Service<Request>,
|
||||
F: Fn(A::Response) -> Response,
|
||||
F: FnMut(A::Response) -> Response,
|
||||
{
|
||||
type Item = Response;
|
||||
type Error = A::Error;
|
||||
@ -107,7 +107,7 @@ impl<A, F, Response> MapNewService<A, F, Response> {
|
||||
pub fn new<Request>(a: A, f: F) -> Self
|
||||
where
|
||||
A: NewService<Request>,
|
||||
F: Fn(A::Response) -> Response,
|
||||
F: FnMut(A::Response) -> Response,
|
||||
{
|
||||
Self {
|
||||
a,
|
||||
@ -134,7 +134,7 @@ where
|
||||
impl<A, F, Request, Response> NewService<Request> for MapNewService<A, F, Response>
|
||||
where
|
||||
A: NewService<Request>,
|
||||
F: Fn(A::Response) -> Response + Clone,
|
||||
F: FnMut(A::Response) -> Response + Clone,
|
||||
{
|
||||
type Response = Response;
|
||||
type Error = A::Error;
|
||||
@ -151,7 +151,7 @@ where
|
||||
pub struct MapNewServiceFuture<A, F, Request, Response>
|
||||
where
|
||||
A: NewService<Request>,
|
||||
F: Fn(A::Response) -> Response,
|
||||
F: FnMut(A::Response) -> Response,
|
||||
{
|
||||
fut: A::Future,
|
||||
f: Option<F>,
|
||||
@ -160,7 +160,7 @@ where
|
||||
impl<A, F, Request, Response> MapNewServiceFuture<A, F, Request, Response>
|
||||
where
|
||||
A: NewService<Request>,
|
||||
F: Fn(A::Response) -> Response,
|
||||
F: FnMut(A::Response) -> Response,
|
||||
{
|
||||
fn new(fut: A::Future, f: F) -> Self {
|
||||
MapNewServiceFuture { f: Some(f), fut }
|
||||
@ -170,7 +170,7 @@ where
|
||||
impl<A, F, Request, Response> Future for MapNewServiceFuture<A, F, Request, Response>
|
||||
where
|
||||
A: NewService<Request>,
|
||||
F: Fn(A::Response) -> Response,
|
||||
F: FnMut(A::Response) -> Response,
|
||||
{
|
||||
type Item = Map<A::Service, F, Response>;
|
||||
type Error = A::InitError;
|
||||
|
Loading…
Reference in New Issue
Block a user