[−][src]Trait actix_web::dev::Service
An asynchronous function from Request
to a Response
.
Associated Types
type Request
Requests handled by the service.
type Response
Responses given by the service.
type Error
Errors produced by the service.
type Future: Future
The future response value.
Required methods
fn poll_ready(&mut self) -> Result<Async<()>, Self::Error>
Returns Ready
when the service is able to process requests.
If the service is at capacity, then NotReady
is returned and the task
is notified when the service becomes ready again. This function is
expected to be called while on a task.
This is a best effort implementation. False positives are permitted.
It is permitted for the service to return Ready
from a poll_ready
call and the next invocation of call
results in an error.
fn call(&mut self, req: Self::Request) -> Self::Future
Process the request and return the response asynchronously.
This function is expected to be callable off task. As such,
implementations should take care to not call poll_ready
. If the
service is at capacity and the request is unable to be handled, the
returned Future
should resolve to an error.
Calling call
without calling poll_ready
is permitted. The
implementation must be resilient to this fact.
Implementations on Foreign Types
impl<T> Service for UpgradeHandler<T>
[src]
type Request = (Request<Box<dyn Stream<Error = PayloadError, Item = Bytes> + 'static>>, Framed<T, Codec>)
type Response = ()
type Error = Error
type Future = FutureResult<<UpgradeHandler<T> as Service>::Response, <UpgradeHandler<T> as Service>::Error>
fn poll_ready(
&mut self
) -> Result<Async<()>, <UpgradeHandler<T> as Service>::Error>
[src]
&mut self
) -> Result<Async<()>, <UpgradeHandler<T> as Service>::Error>
fn call(
&mut self,
<UpgradeHandler<T> as Service>::Request
) -> <UpgradeHandler<T> as Service>::Future
[src]
&mut self,
<UpgradeHandler<T> as Service>::Request
) -> <UpgradeHandler<T> as Service>::Future
impl<T, P, S, B, X, U> Service for H1ServiceHandler<T, P, S, B, X, U> where
B: MessageBody,
S: Service<Request = Request<Box<dyn Stream<Error = PayloadError, Item = Bytes> + 'static>>>,
T: IoStream,
U: Service<Request = (Request<Box<dyn Stream<Error = PayloadError, Item = Bytes> + 'static>>, Framed<T, Codec>), Response = ()>,
X: Service<Request = Request<Box<dyn Stream<Error = PayloadError, Item = Bytes> + 'static>>, Response = Request<Box<dyn Stream<Error = PayloadError, Item = Bytes> + 'static>>>,
<S as Service>::Error: Into<Error>,
<S as Service>::Response: Into<Response<B>>,
<X as Service>::Error: Into<Error>,
<U as Service>::Error: Display,
[src]
B: MessageBody,
S: Service<Request = Request<Box<dyn Stream<Error = PayloadError, Item = Bytes> + 'static>>>,
T: IoStream,
U: Service<Request = (Request<Box<dyn Stream<Error = PayloadError, Item = Bytes> + 'static>>, Framed<T, Codec>), Response = ()>,
X: Service<Request = Request<Box<dyn Stream<Error = PayloadError, Item = Bytes> + 'static>>, Response = Request<Box<dyn Stream<Error = PayloadError, Item = Bytes> + 'static>>>,
<S as Service>::Error: Into<Error>,
<S as Service>::Response: Into<Response<B>>,
<X as Service>::Error: Into<Error>,
<U as Service>::Error: Display,
type Request = Io<T, P>
type Response = ()
type Error = DispatchError
type Future = Dispatcher<T, S, B, X, U>
fn poll_ready(
&mut self
) -> Result<Async<()>, <H1ServiceHandler<T, P, S, B, X, U> as Service>::Error>
[src]
&mut self
) -> Result<Async<()>, <H1ServiceHandler<T, P, S, B, X, U> as Service>::Error>
fn call(
&mut self,
req: <H1ServiceHandler<T, P, S, B, X, U> as Service>::Request
) -> <H1ServiceHandler<T, P, S, B, X, U> as Service>::Future
[src]
&mut self,
req: <H1ServiceHandler<T, P, S, B, X, U> as Service>::Request
) -> <H1ServiceHandler<T, P, S, B, X, U> as Service>::Future
impl Service for ExpectHandler
[src]
type Request = Request<Box<dyn Stream<Error = PayloadError, Item = Bytes> + 'static>>
type Response = Request<Box<dyn Stream<Error = PayloadError, Item = Bytes> + 'static>>
type Error = Error
type Future = FutureResult<<ExpectHandler as Service>::Response, <ExpectHandler as Service>::Error>
fn poll_ready(&mut self) -> Result<Async<()>, <ExpectHandler as Service>::Error>
[src]
fn call(
&mut self,
req: Request<Box<dyn Stream<Error = PayloadError, Item = Bytes> + 'static>>
) -> <ExpectHandler as Service>::Future
[src]
&mut self,
req: Request<Box<dyn Stream<Error = PayloadError, Item = Bytes> + 'static>>
) -> <ExpectHandler as Service>::Future
impl<A, B> Service for Then<A, B> where
A: Service,
B: Service<Request = Result<<A as Service>::Response, <A as Service>::Error>, Error = <A as Service>::Error>,
[src]
A: Service,
B: Service<Request = Result<<A as Service>::Response, <A as Service>::Error>, Error = <A as Service>::Error>,
type Request = <A as Service>::Request
type Response = <B as Service>::Response
type Error = <B as Service>::Error
type Future = ThenFuture<A, B>
fn poll_ready(&mut self) -> Result<Async<()>, <Then<A, B> as Service>::Error>
[src]
fn call(
&mut self,
req: <A as Service>::Request
) -> <Then<A, B> as Service>::Future
[src]
&mut self,
req: <A as Service>::Request
) -> <Then<A, B> as Service>::Future
impl<S> Service for Box<S> where
S: Service + ?Sized,
[src]
S: Service + ?Sized,
type Request = <S as Service>::Request
type Response = <S as Service>::Response
type Error = <S as Service>::Error
type Future = <S as Service>::Future
fn poll_ready(&mut self) -> Result<Async<()>, <S as Service>::Error>
[src]
fn call(
&mut self,
request: <Box<S> as Service>::Request
) -> <S as Service>::Future
[src]
&mut self,
request: <Box<S> as Service>::Request
) -> <S as Service>::Future
impl<R, E> Service for Blank<R, E>
[src]
type Request = R
type Response = R
type Error = E
type Future = FutureResult<R, E>
fn poll_ready(&mut self) -> Result<Async<()>, <Blank<R, E> as Service>::Error>
[src]
fn call(&mut self, req: R) -> <Blank<R, E> as Service>::Future
[src]
impl<'a, S> Service for &'a mut S where
S: Service + 'a,
[src]
S: Service + 'a,
type Request = <S as Service>::Request
type Response = <S as Service>::Response
type Error = <S as Service>::Error
type Future = <S as Service>::Future
fn poll_ready(&mut self) -> Result<Async<()>, <S as Service>::Error>
[src]
fn call(
&mut self,
request: <&'a mut S as Service>::Request
) -> <S as Service>::Future
[src]
&mut self,
request: <&'a mut S as Service>::Request
) -> <S as Service>::Future
impl<A, B> Service for AndThen<A, B> where
A: Service,
B: Service<Request = <A as Service>::Response, Error = <A as Service>::Error>,
[src]
A: Service,
B: Service<Request = <A as Service>::Response, Error = <A as Service>::Error>,
type Request = <A as Service>::Request
type Response = <B as Service>::Response
type Error = <A as Service>::Error
type Future = AndThenFuture<A, B>
fn poll_ready(&mut self) -> Result<Async<()>, <AndThen<A, B> as Service>::Error>
[src]
fn call(
&mut self,
req: <A as Service>::Request
) -> <AndThen<A, B> as Service>::Future
[src]
&mut self,
req: <A as Service>::Request
) -> <AndThen<A, B> as Service>::Future
impl<S> Service for Rc<RefCell<S>> where
S: Service,
[src]
S: Service,
type Request = <S as Service>::Request
type Response = <S as Service>::Response
type Error = <S as Service>::Error
type Future = <S as Service>::Future
fn poll_ready(&mut self) -> Result<Async<()>, <S as Service>::Error>
[src]
fn call(
&mut self,
request: <Rc<RefCell<S>> as Service>::Request
) -> <S as Service>::Future
[src]
&mut self,
request: <Rc<RefCell<S>> as Service>::Request
) -> <S as Service>::Future
impl<F, Req, Out> Service for ServiceFn<F, Req, Out> where
F: FnMut(Req) -> Out,
Out: IntoFuture,
[src]
F: FnMut(Req) -> Out,
Out: IntoFuture,
type Request = Req
type Response = <Out as IntoFuture>::Item
type Error = <Out as IntoFuture>::Error
type Future = <Out as IntoFuture>::Future
fn poll_ready(
&mut self
) -> Result<Async<()>, <ServiceFn<F, Req, Out> as Service>::Error>
[src]
&mut self
) -> Result<Async<()>, <ServiceFn<F, Req, Out> as Service>::Error>
fn call(&mut self, req: Req) -> <ServiceFn<F, Req, Out> as Service>::Future
[src]
impl<A, F, E> Service for MapErr<A, F, E> where
A: Service,
F: Fn(<A as Service>::Error) -> E + Clone,
[src]
A: Service,
F: Fn(<A as Service>::Error) -> E + Clone,
type Request = <A as Service>::Request
type Response = <A as Service>::Response
type Error = E
type Future = MapErrFuture<A, F, E>
fn poll_ready(
&mut self
) -> Result<Async<()>, <MapErr<A, F, E> as Service>::Error>
[src]
&mut self
) -> Result<Async<()>, <MapErr<A, F, E> as Service>::Error>
fn call(
&mut self,
req: <A as Service>::Request
) -> <MapErr<A, F, E> as Service>::Future
[src]
&mut self,
req: <A as Service>::Request
) -> <MapErr<A, F, E> as Service>::Future
impl<A, E> Service for FromErr<A, E> where
A: Service,
E: From<<A as Service>::Error>,
[src]
A: Service,
E: From<<A as Service>::Error>,
type Request = <A as Service>::Request
type Response = <A as Service>::Response
type Error = E
type Future = FromErrFuture<A, E>
fn poll_ready(&mut self) -> Result<Async<()>, E>
[src]
fn call(
&mut self,
req: <A as Service>::Request
) -> <FromErr<A, E> as Service>::Future
[src]
&mut self,
req: <A as Service>::Request
) -> <FromErr<A, E> as Service>::Future
impl<A, F, Response> Service for Map<A, F, Response> where
A: Service,
F: FnMut(<A as Service>::Response) -> Response + Clone,
[src]
A: Service,
F: FnMut(<A as Service>::Response) -> Response + Clone,
type Request = <A as Service>::Request
type Response = Response
type Error = <A as Service>::Error
type Future = MapFuture<A, F, Response>
fn poll_ready(
&mut self
) -> Result<Async<()>, <Map<A, F, Response> as Service>::Error>
[src]
&mut self
) -> Result<Async<()>, <Map<A, F, Response> as Service>::Error>
fn call(
&mut self,
req: <A as Service>::Request
) -> <Map<A, F, Response> as Service>::Future
[src]
&mut self,
req: <A as Service>::Request
) -> <Map<A, F, Response> as Service>::Future
impl<T> Service for TcpConnector<T> where
T: Address,
[src]
T: Address,
type Request = Connect<T>
type Response = Connection<T, TcpStream>
type Error = ConnectError
type Future = Either<TcpConnectorResponse<T>, FutureResult<<TcpConnector<T> as Service>::Response, <TcpConnector<T> as Service>::Error>>
fn poll_ready(
&mut self
) -> Result<Async<()>, <TcpConnector<T> as Service>::Error>
[src]
&mut self
) -> Result<Async<()>, <TcpConnector<T> as Service>::Error>
fn call(&mut self, req: Connect<T>) -> <TcpConnector<T> as Service>::Future
[src]
impl<T> Service for Resolver<T> where
T: Address,
[src]
T: Address,
type Request = Connect<T>
type Response = Connect<T>
type Error = ConnectError
type Future = Either<ResolverFuture<T>, FutureResult<Connect<T>, <Resolver<T> as Service>::Error>>
fn poll_ready(&mut self) -> Result<Async<()>, <Resolver<T> as Service>::Error>
[src]
fn call(&mut self, req: Connect<T>) -> <Resolver<T> as Service>::Future
[src]
impl<T> Service for OpensslConnectService<T> where
T: Address,
[src]
T: Address,
type Request = Connect<T>
type Response = SslStream<TcpStream>
type Error = ConnectError
type Future = OpensslConnectServiceResponse<T>
fn poll_ready(
&mut self
) -> Result<Async<()>, <OpensslConnectService<T> as Service>::Error>
[src]
&mut self
) -> Result<Async<()>, <OpensslConnectService<T> as Service>::Error>
fn call(
&mut self,
req: Connect<T>
) -> <OpensslConnectService<T> as Service>::Future
[src]
&mut self,
req: Connect<T>
) -> <OpensslConnectService<T> as Service>::Future
impl<T> Service for ConnectService<T> where
T: Address,
[src]
T: Address,
type Request = Connect<T>
type Response = Connection<T, TcpStream>
type Error = ConnectError
type Future = ConnectServiceResponse<T>
fn poll_ready(
&mut self
) -> Result<Async<()>, <ConnectService<T> as Service>::Error>
[src]
&mut self
) -> Result<Async<()>, <ConnectService<T> as Service>::Error>
fn call(&mut self, req: Connect<T>) -> <ConnectService<T> as Service>::Future
[src]
impl<R, E, F> Service for KeepAliveService<R, E, F> where
F: Fn() -> E,
[src]
F: Fn() -> E,
type Request = R
type Response = R
type Error = E
type Future = FutureResult<R, E>
fn poll_ready(
&mut self
) -> Result<Async<()>, <KeepAliveService<R, E, F> as Service>::Error>
[src]
&mut self
) -> Result<Async<()>, <KeepAliveService<R, E, F> as Service>::Error>
fn call(&mut self, req: R) -> <KeepAliveService<R, E, F> as Service>::Future
[src]
impl<S, T, E> Service for StreamService<S, T, E> where
S: 'static + IntoStream,
T: NewService<Request = Result<<S as IntoStream>::Item, <S as IntoStream>::Error>, Response = (), Error = E, InitError = E>,
<T as NewService>::Future: 'static,
<T as NewService>::Service: 'static,
<<T as NewService>::Service as Service>::Future: 'static,
[src]
S: 'static + IntoStream,
T: NewService<Request = Result<<S as IntoStream>::Item, <S as IntoStream>::Error>, Response = (), Error = E, InitError = E>,
<T as NewService>::Future: 'static,
<T as NewService>::Service: 'static,
<<T as NewService>::Service as Service>::Future: 'static,
type Request = S
type Response = ()
type Error = E
type Future = Box<dyn Future<Error = E, Item = ()> + 'static>
fn poll_ready(
&mut self
) -> Result<Async<()>, <StreamService<S, T, E> as Service>::Error>
[src]
&mut self
) -> Result<Async<()>, <StreamService<S, T, E> as Service>::Error>
fn call(&mut self, req: S) -> <StreamService<S, T, E> as Service>::Future
[src]
impl<A, B> Service for EitherService<A, B> where
A: Service,
B: Service<Response = <A as Service>::Response, Error = <A as Service>::Error>,
[src]
A: Service,
B: Service<Response = <A as Service>::Response, Error = <A as Service>::Error>,
type Request = Either<<A as Service>::Request, <B as Service>::Request>
type Response = <A as Service>::Response
type Error = <A as Service>::Error
type Future = Either<<A as Service>::Future, <B as Service>::Future>
fn poll_ready(
&mut self
) -> Result<Async<()>, <EitherService<A, B> as Service>::Error>
[src]
&mut self
) -> Result<Async<()>, <EitherService<A, B> as Service>::Error>
fn call(
&mut self,
req: Either<<A as Service>::Request, <B as Service>::Request>
) -> <EitherService<A, B> as Service>::Future
[src]
&mut self,
req: Either<<A as Service>::Request, <B as Service>::Request>
) -> <EitherService<A, B> as Service>::Future
impl<S> Service for InOrderService<S> where
S: Service,
<S as Service>::Response: 'static,
<S as Service>::Future: 'static,
<S as Service>::Error: 'static,
[src]
S: Service,
<S as Service>::Response: 'static,
<S as Service>::Future: 'static,
<S as Service>::Error: 'static,
type Request = <S as Service>::Request
type Response = <S as Service>::Response
type Error = InOrderError<<S as Service>::Error>
type Future = InOrderServiceResponse<S>
fn poll_ready(
&mut self
) -> Result<Async<()>, <InOrderService<S> as Service>::Error>
[src]
&mut self
) -> Result<Async<()>, <InOrderService<S> as Service>::Error>
fn call(
&mut self,
request: <S as Service>::Request
) -> <InOrderService<S> as Service>::Future
[src]
&mut self,
request: <S as Service>::Request
) -> <InOrderService<S> as Service>::Future
impl<S> Service for TimeoutService<S> where
S: Service,
[src]
S: Service,
type Request = <S as Service>::Request
type Response = <S as Service>::Response
type Error = TimeoutError<<S as Service>::Error>
type Future = TimeoutServiceResponse<S>
fn poll_ready(
&mut self
) -> Result<Async<()>, <TimeoutService<S> as Service>::Error>
[src]
&mut self
) -> Result<Async<()>, <TimeoutService<S> as Service>::Error>
fn call(
&mut self,
request: <S as Service>::Request
) -> <TimeoutService<S> as Service>::Future
[src]
&mut self,
request: <S as Service>::Request
) -> <TimeoutService<S> as Service>::Future
impl Service for LowResTimeService
[src]
type Request = ()
type Response = Instant
type Error = Infallible
type Future = FutureResult<<LowResTimeService as Service>::Response, <LowResTimeService as Service>::Error>
fn poll_ready(
&mut self
) -> Result<Async<()>, <LowResTimeService as Service>::Error>
[src]
&mut self
) -> Result<Async<()>, <LowResTimeService as Service>::Error>
fn call(&mut self, ()) -> <LowResTimeService as Service>::Future
[src]
impl<T> Service for InFlightService<T> where
T: Service,
[src]
T: Service,
type Request = <T as Service>::Request
type Response = <T as Service>::Response
type Error = <T as Service>::Error
type Future = InFlightServiceResponse<T>
fn poll_ready(
&mut self
) -> Result<Async<()>, <InFlightService<T> as Service>::Error>
[src]
&mut self
) -> Result<Async<()>, <InFlightService<T> as Service>::Error>
fn call(
&mut self,
req: <T as Service>::Request
) -> <InFlightService<T> as Service>::Future
[src]
&mut self,
req: <T as Service>::Request
) -> <InFlightService<T> as Service>::Future