[−][src]Trait actix_service::Service
An asynchronous function from Request
to a Response
.
Associated Types
type Response
Responses given by the service.
type Error
Errors produced by the service.
type Future: Future<Item = Self::Response, Error = Self::Error>
The future response value.
Required methods
fn poll_ready(&mut self) -> Poll<(), 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: 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<'a, S, Request> Service<Request> for &'a mut S where
S: Service<Request> + 'a,
[src]
impl<'a, S, Request> Service<Request> for &'a mut S where
S: Service<Request> + 'a,
type Response = S::Response
type Error = S::Error
type Future = S::Future
fn poll_ready(&mut self) -> Poll<(), S::Error> | [src] |
fn call(&mut self, request: Request) -> S::Future | [src] |
impl<S: ?Sized, Request> Service<Request> for Box<S> where
S: Service<Request>,
[src]
impl<S: ?Sized, Request> Service<Request> for Box<S> where
S: Service<Request>,
type Response = S::Response
type Error = S::Error
type Future = S::Future
fn poll_ready(&mut self) -> Poll<(), S::Error> | [src] |
fn call(&mut self, request: Request) -> S::Future | [src] |
Implementors
impl<A, B, Request> Service<Request> for AndThen<A, B> where
A: Service<Request>,
B: Service<A::Response, Error = A::Error>,
[src]
impl<A, B, Request> Service<Request> for AndThen<A, B> where
A: Service<Request>,
B: Service<A::Response, Error = A::Error>,
type Response = B::Response
type Error = A::Error
type Future = AndThenFuture<A, B, Request>
fn poll_ready(&mut self) -> Poll<(), Self::Error> | [src] |
fn call(&mut self, req: Request) -> Self::Future | [src] |
impl<A, B, Request> Service<Request> for Then<A, B> where
A: Service<Request>,
B: Service<Result<A::Response, A::Error>, Error = A::Error>,
[src]
impl<A, B, Request> Service<Request> for Then<A, B> where
A: Service<Request>,
B: Service<Result<A::Response, A::Error>, Error = A::Error>,
type Response = B::Response
type Error = B::Error
type Future = ThenFuture<A, B, Request>
fn poll_ready(&mut self) -> Poll<(), Self::Error> | [src] |
fn call(&mut self, req: Request) -> Self::Future | [src] |
impl<A, E, Request> Service<Request> for FromErr<A, E> where
A: Service<Request>,
E: From<A::Error>,
[src]
impl<A, E, Request> Service<Request> for FromErr<A, E> where
A: Service<Request>,
E: From<A::Error>,
type Response = A::Response
type Error = E
type Future = FromErrFuture<A, E, Request>
fn poll_ready(&mut self) -> Poll<(), E> | [src] |
fn call(&mut self, req: Request) -> Self::Future | [src] |
impl<A, F, E, Request> Service<Request> for MapErr<A, F, E> where
A: Service<Request>,
F: Fn(A::Error) -> E + Clone,
[src]
impl<A, F, E, Request> Service<Request> for MapErr<A, F, E> where
A: Service<Request>,
F: Fn(A::Error) -> E + Clone,
type Response = A::Response
type Error = E
type Future = MapErrFuture<A, F, E, Request>
fn poll_ready(&mut self) -> Poll<(), Self::Error> | [src] |
fn call(&mut self, req: Request) -> Self::Future | [src] |
impl<A, F, Request, Response> Service<Request> for Map<A, F, Response> where
A: Service<Request>,
F: Fn(A::Response) -> Response + Clone,
[src]
impl<A, F, Request, Response> Service<Request> for Map<A, F, Response> where
A: Service<Request>,
F: Fn(A::Response) -> Response + Clone,
type Response = Response
type Error = A::Error
type Future = MapFuture<A, F, Request, Response>
fn poll_ready(&mut self) -> Poll<(), Self::Error> | [src] |
fn call(&mut self, req: Request) -> Self::Future | [src] |
impl<F, Req, Resp, E, Fut> Service<Req> for FnService<F, Req, Resp, E, Fut> where
F: FnMut(Req) -> Fut,
Fut: IntoFuture<Item = Resp, Error = E>,
[src]
impl<F, Req, Resp, E, Fut> Service<Req> for FnService<F, Req, Resp, E, Fut> where
F: FnMut(Req) -> Fut,
Fut: IntoFuture<Item = Resp, Error = E>,
type Response = Resp
type Error = E
type Future = Fut::Future
fn poll_ready(&mut self) -> Poll<(), Self::Error> | [src] |
fn call(&mut self, req: Req) -> Self::Future | [src] |
impl<T, F, In, Out, Request> Service<In> for Apply<T, F, In, Out, Request> where
T: Service<Request>,
F: Fn(In, &mut T) -> Out,
Out: IntoFuture,
Out::Error: From<T::Error>,
[src]
impl<T, F, In, Out, Request> Service<In> for Apply<T, F, In, Out, Request> where
T: Service<Request>,
F: Fn(In, &mut T) -> Out,
Out: IntoFuture,
Out::Error: From<T::Error>,