mirror of
https://github.com/fafhrd91/actix-net
synced 2024-11-23 21:51:06 +01:00
use FnMut for apply combinator
This commit is contained in:
parent
36a15efeac
commit
42a4679635
@ -17,7 +17,7 @@ where
|
||||
impl<T, F, In, Out, Request> Apply<T, F, In, Out, Request>
|
||||
where
|
||||
T: Service<Request>,
|
||||
F: Fn(In, &mut T) -> Out,
|
||||
F: FnMut(In, &mut T) -> Out,
|
||||
Out: IntoFuture,
|
||||
{
|
||||
/// Create new `Apply` combinator
|
||||
@ -47,7 +47,7 @@ where
|
||||
impl<T, F, In, Out, Request> Service<In> for Apply<T, F, In, Out, Request>
|
||||
where
|
||||
T: Service<Request, Error = Out::Error>,
|
||||
F: Fn(In, &mut T) -> Out,
|
||||
F: FnMut(In, &mut T) -> Out,
|
||||
Out: IntoFuture,
|
||||
{
|
||||
type Response = <Out::Future as Future>::Item;
|
||||
@ -76,7 +76,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,
|
||||
{
|
||||
/// Create new `ApplyNewService` new service instance
|
||||
@ -92,7 +92,7 @@ where
|
||||
impl<T, F, In, Out, Request> Clone for ApplyNewService<T, F, In, Out, Request>
|
||||
where
|
||||
T: NewService<Request> + Clone,
|
||||
F: Fn(Out, &mut T::Service) -> Out + Clone,
|
||||
F: FnMut(Out, &mut T::Service) -> Out + Clone,
|
||||
Out: IntoFuture,
|
||||
{
|
||||
fn clone(&self) -> Self {
|
||||
@ -107,7 +107,7 @@ where
|
||||
impl<T, F, In, Out, Request> NewService<In> for ApplyNewService<T, F, In, Out, Request>
|
||||
where
|
||||
T: NewService<Request, Error = Out::Error>,
|
||||
F: Fn(In, &mut T::Service) -> Out + Clone,
|
||||
F: FnMut(In, &mut T::Service) -> Out + Clone,
|
||||
Out: IntoFuture,
|
||||
{
|
||||
type Response = <Out::Future as Future>::Item;
|
||||
@ -125,7 +125,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,
|
||||
@ -136,7 +136,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 {
|
||||
@ -151,7 +151,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,
|
||||
{
|
||||
type Item = Apply<T::Service, F, In, Out, Request>;
|
||||
|
@ -35,7 +35,7 @@ pub trait ServiceExt<Request>: Service<Request> {
|
||||
Self: Sized,
|
||||
T: Service<Req, Error = Out::Error>,
|
||||
I: IntoService<T, Req>,
|
||||
F: Fn(Self::Response, &mut T) -> Out,
|
||||
F: FnMut(Self::Response, &mut T) -> Out,
|
||||
Out: IntoFuture<Error = Self::Error>,
|
||||
{
|
||||
self.and_then(Apply::new(service.into_service(), f))
|
||||
@ -158,7 +158,7 @@ pub trait NewServiceExt<Request>: NewService<Request> {
|
||||
Self: Sized,
|
||||
T: NewService<Req, InitError = Self::InitError, Error = Out::Error>,
|
||||
I: IntoNewService<T, Req>,
|
||||
F: Fn(Self::Response, &mut T::Service) -> Out + Clone,
|
||||
F: FnMut(Self::Response, &mut T::Service) -> Out + Clone,
|
||||
Out: IntoFuture<Error = Self::Error>,
|
||||
{
|
||||
self.and_then(ApplyNewService::new(service, f))
|
||||
|
Loading…
Reference in New Issue
Block a user