[−][src]Trait async_svc::Svc
Service trait representing an asynchronous request/response operation.
Associated Types
Loading content...Required methods
pub fn exec(self: Pin<&mut Self>, req: Req) -> Self::Fut
Processes request, producing a future that outputs the response type.
Provided methods
pub fn poll_ready(self: Pin<&mut Self>, cx: Context<'_>) -> Poll<()>
To be called before exec
to signal wether the service is ready to process requests.
As such, the check should be inexpensive. Returning Poll::Pending
acts as back-pressure.
The default implementation unconditionally indicates the service is ready.
Implementations on Foreign Types
impl<S, Req> Svc<Req> for Box<S> where
S: Svc<Req>,
[src]
S: Svc<Req>,
type Res = S::Res
type Fut = S::Fut
pub fn poll_ready(self: Pin<&mut Self>, cx: Context<'_>) -> Poll<()>
[src]
pub fn exec(self: Pin<&mut Self>, req: Req) -> Self::Fut
[src]
Implementors
impl<F, Req, Fut, Res> Svc<Req> for FnSvc<F> where
F: FnMut(Req) -> Fut + Unpin,
Fut: Future<Output = Res>,
[src]
F: FnMut(Req) -> Fut + Unpin,
Fut: Future<Output = Res>,
impl<Req, Res> Svc<Req> for BoxSvc<Req, Res>
[src]
type Res = Res
type Fut = BoxFut<Res>
pub fn poll_ready(self: Pin<&mut Self>, cx: Context<'_>) -> Poll<()>
[src]
pub fn exec(self: Pin<&mut Self>, req: Req) -> Self::Fut
[src]
impl<S1, S2, Req, Int, Res> Svc<Req> for ThenSvc<S1, S2, Int, Res> where
S1: Svc<Req, Res = Int>,
S2: Svc<Int, Res = Res>,
[src]
S1: Svc<Req, Res = Int>,
S2: Svc<Int, Res = Res>,
type Res = Res
type Fut = ThenSvcFut<S1, S2, Req, Int, Res>
pub fn exec(self: Pin<&mut Self>, req: Req) -> Self::Fut
[src]
impl<S, Req, F, Res> Svc<Req> for MapSvc<S, F, Res> where
S: Svc<Req>,
F: FnMut(S::Res) -> Res + Clone,
[src]
S: Svc<Req>,
F: FnMut(S::Res) -> Res + Clone,