pub struct Pipeline<Req, Res, Err> { /* private fields */ }Expand description
Execution container for a service and its state.
A pipeline coordinates readiness, calls, and shutdown for the enclosed service chain.
Implementations§
Source§impl<Req, Res, Err> Pipeline<Req, Res, Err>where
Req: 'static,
Res: 'static,
Err: 'static,
impl<Req, Res, Err> Pipeline<Req, Res, Err>where
Req: 'static,
Res: 'static,
Err: 'static,
Sourcepub fn new<S, St>(
st: St,
service: impl IntoService<S, St, Req>,
) -> Pipeline<Req, Res, Err>where
S: Service<St, Req, Res = Res, Error = Err> + 'static,
St: 'static,
pub fn new<S, St>(
st: St,
service: impl IntoService<S, St, Req>,
) -> Pipeline<Req, Res, Err>where
S: Service<St, Req, Res = Res, Error = Err> + 'static,
St: 'static,
Creates a pipeline containing service and state.
Sourcepub async fn ready(&self) -> Result<(), Err>
pub async fn ready(&self) -> Result<(), Err>
Returns when the pipeline is ready to process requests.
A successful check is consumed by the next call, which then skips its own readiness check.
Sourcepub async fn call(&self, req: Req) -> Result<Res, Err>
pub async fn call(&self, req: Req) -> Result<Res, Err>
Waits for readiness, then calls the service.
The readiness check is skipped if the last pipeline readiness check succeeded and no call has started since.
Sourcepub fn call_static(&self, req: Req) -> PipelineCall<Req, Res, Err> ⓘ
pub fn call_static(&self, req: Req) -> PipelineCall<Req, Res, Err> ⓘ
Returns an owned future that waits for readiness and calls the service.
Unlike Pipeline::call, the returned future does not borrow the
pipeline and can be moved between local tasks. The readiness check is
skipped if the last pipeline readiness check succeeded and no call has
started since; this is decided when the future is first polled.
Sourcepub fn poll_ready(&self, cx: &mut Context<'_>) -> Poll<Result<(), Err>>
pub fn poll_ready(&self, cx: &mut Context<'_>) -> Poll<Result<(), Err>>
Returns Ready when the pipeline is ready to process requests.
A successful check is consumed by the next call, which then skips its own readiness check.
Sourcepub fn poll_shutdown(&self, cx: &mut Context<'_>) -> Poll<()>
pub fn poll_shutdown(&self, cx: &mut Context<'_>) -> Poll<()>
Returns Ready when the service has been properly shut down.
Sourcepub fn is_shutdown(&self) -> bool
pub fn is_shutdown(&self) -> bool
Checks whether pipeline shutdown has been initiated.
Sourcepub fn bind(&self) -> PipelineBinding<Req, Res, Err>
pub fn bind(&self) -> PipelineBinding<Req, Res, Err>
Creates a new binding to this pipeline.
The binding can be used to check readiness and call the service.