pub struct ServiceFn<T, K> { /* private fields */ }
Expand description
An executable service implemented by a closure.
See service_fn
for more details.
Trait Implementations§
source§impl<T, F, Req, E, R> Service<Request<Req>> for ServiceFn<T, ()>
impl<T, F, Req, E, R> Service<Request<Req>> for ServiceFn<T, ()>
source§impl<T, F, Req, E, R, A1, A2> Service<Request<Req>> for ServiceFn<T, (A1, A2)>
impl<T, F, Req, E, R, A1, A2> Service<Request<Req>> for ServiceFn<T, (A1, A2)>
source§impl<T, F, Req, E, R, A1, A2, A3> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3)>
impl<T, F, Req, E, R, A1, A2, A3> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3)>
source§impl<T, F, Req, E, R, A1, A2, A3, A4> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4)>
impl<T, F, Req, E, R, A1, A2, A3, A4> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4)>
source§impl<T, F, Req, E, R, A1, A2, A3, A4, A5> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5)>
impl<T, F, Req, E, R, A1, A2, A3, A4, A5> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5)>
source§impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6)>
impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6)>
source§impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6, A7> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6, A7)>
impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6, A7> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6, A7)>
source§impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6, A7, A8> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6, A7, A8)>
impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6, A7, A8> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6, A7, A8)>
source§impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6, A7, A8, A9> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6, A7, A8, A9)>
impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6, A7, A8, A9> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6, A7, A8, A9)>
source§impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)>
impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)>
source§impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)>
impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)>
source§impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)>where
T: FnMut(Req, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12) -> F,
F: Future,
<F as Future>::Output: IntoResponse<Result = Result<R, E>>,
A1: FromData,
A2: FromData,
A3: FromData,
A4: FromData,
A5: FromData,
A6: FromData,
A7: FromData,
A8: FromData,
A9: FromData,
A10: FromData,
A11: FromData,
A12: FromData,
impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)>where
T: FnMut(Req, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12) -> F,
F: Future,
<F as Future>::Output: IntoResponse<Result = Result<R, E>>,
A1: FromData,
A2: FromData,
A3: FromData,
A4: FromData,
A5: FromData,
A6: FromData,
A7: FromData,
A8: FromData,
A9: FromData,
A10: FromData,
A11: FromData,
A12: FromData,
source§impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)>where
T: FnMut(Req, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13) -> F,
F: Future,
<F as Future>::Output: IntoResponse<Result = Result<R, E>>,
A1: FromData,
A2: FromData,
A3: FromData,
A4: FromData,
A5: FromData,
A6: FromData,
A7: FromData,
A8: FromData,
A9: FromData,
A10: FromData,
A11: FromData,
A12: FromData,
A13: FromData,
impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)>where
T: FnMut(Req, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13) -> F,
F: Future,
<F as Future>::Output: IntoResponse<Result = Result<R, E>>,
A1: FromData,
A2: FromData,
A3: FromData,
A4: FromData,
A5: FromData,
A6: FromData,
A7: FromData,
A8: FromData,
A9: FromData,
A10: FromData,
A11: FromData,
A12: FromData,
A13: FromData,
source§impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)>where
T: FnMut(Req, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14) -> F,
F: Future,
<F as Future>::Output: IntoResponse<Result = Result<R, E>>,
A1: FromData,
A2: FromData,
A3: FromData,
A4: FromData,
A5: FromData,
A6: FromData,
A7: FromData,
A8: FromData,
A9: FromData,
A10: FromData,
A11: FromData,
A12: FromData,
A13: FromData,
A14: FromData,
impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)>where
T: FnMut(Req, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14) -> F,
F: Future,
<F as Future>::Output: IntoResponse<Result = Result<R, E>>,
A1: FromData,
A2: FromData,
A3: FromData,
A4: FromData,
A5: FromData,
A6: FromData,
A7: FromData,
A8: FromData,
A9: FromData,
A10: FromData,
A11: FromData,
A12: FromData,
A13: FromData,
A14: FromData,
source§impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)>where
T: FnMut(Req, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15) -> F,
F: Future,
<F as Future>::Output: IntoResponse<Result = Result<R, E>>,
A1: FromData,
A2: FromData,
A3: FromData,
A4: FromData,
A5: FromData,
A6: FromData,
A7: FromData,
A8: FromData,
A9: FromData,
A10: FromData,
A11: FromData,
A12: FromData,
A13: FromData,
A14: FromData,
A15: FromData,
impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)>where
T: FnMut(Req, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15) -> F,
F: Future,
<F as Future>::Output: IntoResponse<Result = Result<R, E>>,
A1: FromData,
A2: FromData,
A3: FromData,
A4: FromData,
A5: FromData,
A6: FromData,
A7: FromData,
A8: FromData,
A9: FromData,
A10: FromData,
A11: FromData,
A12: FromData,
A13: FromData,
A14: FromData,
A15: FromData,
source§impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)>where
T: FnMut(Req, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16) -> F,
F: Future,
<F as Future>::Output: IntoResponse<Result = Result<R, E>>,
A1: FromData,
A2: FromData,
A3: FromData,
A4: FromData,
A5: FromData,
A6: FromData,
A7: FromData,
A8: FromData,
A9: FromData,
A10: FromData,
A11: FromData,
A12: FromData,
A13: FromData,
A14: FromData,
A15: FromData,
A16: FromData,
impl<T, F, Req, E, R, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16> Service<Request<Req>> for ServiceFn<T, (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)>where
T: FnMut(Req, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16) -> F,
F: Future,
<F as Future>::Output: IntoResponse<Result = Result<R, E>>,
A1: FromData,
A2: FromData,
A3: FromData,
A4: FromData,
A5: FromData,
A6: FromData,
A7: FromData,
A8: FromData,
A9: FromData,
A10: FromData,
A11: FromData,
A12: FromData,
A13: FromData,
A14: FromData,
A15: FromData,
A16: FromData,
source§impl<T, F, Req, E, R, A> Service<Request<Req>> for ServiceFn<T, A>
impl<T, F, Req, E, R, A> Service<Request<Req>> for ServiceFn<T, A>
impl<T, K> Copy for ServiceFn<T, K>
Auto Trait Implementations§
impl<T, K> Freeze for ServiceFn<T, K>where
T: Freeze,
impl<T, K> RefUnwindSafe for ServiceFn<T, K>where
T: RefUnwindSafe,
K: RefUnwindSafe,
impl<T, K> Send for ServiceFn<T, K>
impl<T, K> Sync for ServiceFn<T, K>
impl<T, K> Unpin for ServiceFn<T, K>
impl<T, K> UnwindSafe for ServiceFn<T, K>where
T: UnwindSafe,
K: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T, Request> ServiceExt<Request> for T
impl<T, Request> ServiceExt<Request> for T
source§fn ready(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
fn ready(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
Yields a mutable reference to the service when it is ready to accept a request.
source§fn ready_and(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
fn ready_and(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
👎Deprecated since 0.4.6: please use the
ServiceExt::ready
method insteadYields a mutable reference to the service when it is ready to accept a request.
source§fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where
Self: Sized,
fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where
Self: Sized,
Yields the service when it is ready to accept a request.
source§fn oneshot(self, req: Request) -> Oneshot<Self, Request>where
Self: Sized,
fn oneshot(self, req: Request) -> Oneshot<Self, Request>where
Self: Sized,
Consume this
Service
, calling with the providing request once it is ready.source§fn and_then<F>(self, f: F) -> AndThen<Self, F>
fn and_then<F>(self, f: F) -> AndThen<Self, F>
Executes a new future after this service’s future resolves. This does
not alter the behaviour of the
poll_ready
method. Read moresource§fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
Maps this service’s response value to a different value. This does not
alter the behaviour of the
poll_ready
method. Read moresource§fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
Maps this service’s error value to a different value. This does not
alter the behaviour of the
poll_ready
method. Read moresource§fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
Maps this service’s result type (
Result<Self::Response, Self::Error>
)
to a different value, regardless of whether the future succeeds or
fails. Read moresource§fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>
fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>
Composes a function in front of the service. Read more
source§fn filter_async<F, NewRequest>(self, filter: F) -> AsyncFilter<Self, F>where
Self: Sized,
F: AsyncPredicate<NewRequest>,
fn filter_async<F, NewRequest>(self, filter: F) -> AsyncFilter<Self, F>where
Self: Sized,
F: AsyncPredicate<NewRequest>,
Composes this service with an
AsyncFilter
that conditionally accepts or
rejects requests based on an [async predicate]. Read moresource§fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>
fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>
Composes an asynchronous function after this service. Read more
source§fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>
fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>
Composes a function that transforms futures produced by the service. Read more