pub struct PipelineState<St, Req, Res, Err> { /* private fields */ }Expand description
Execution container for a service whose state is supplied per operation.
Unlike crate::Pipeline, this type does not own a state value. Callers
provide a state reference when checking readiness, calling, or shutting
down the service.
Implementations§
Source§impl<St, Req, Res, Err> PipelineState<St, Req, Res, Err>where
St: 'static,
Req: 'static,
Res: 'static,
Err: 'static,
impl<St, Req, Res, Err> PipelineState<St, Req, Res, Err>where
St: 'static,
Req: 'static,
Res: 'static,
Err: 'static,
Sourcepub fn new<S>(service: impl IntoService<S, St, Req>) -> Selfwhere
S: Service<St, Req, Res = Res, Error = Err> + 'static,
St: 'static,
pub fn new<S>(service: impl IntoService<S, St, Req>) -> Selfwhere
S: Service<St, Req, Res = Res, Error = Err> + 'static,
St: 'static,
Creates a state-independent pipeline containing service.
Sourcepub async fn ready(&self, st: &St) -> Result<(), Err>
pub async fn ready(&self, st: &St) -> 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, st: &St) -> Result<Res, Err>
pub async fn call(&self, req: Req, st: &St) -> Result<Res, Err>
Waits for readiness, then calls the service with st.
The readiness check is skipped if the last pipeline readiness check succeeded and no call has started since.
Sourcepub fn poll_ready(&self, cx: &mut Context<'_>, st: &St) -> Poll<Result<(), Err>>where
St: Clone,
pub fn poll_ready(&self, cx: &mut Context<'_>, st: &St) -> Poll<Result<(), Err>>where
St: Clone,
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.
§Panics
Panics if .shutdown() has been called. Unlike crate::Pipeline::poll_ready,
it does not return Ready(Ok(())) after shutdown.
Sourcepub fn bind(&self) -> PipelineStateBinding<St, Req, Res, Err>
pub fn bind(&self) -> PipelineStateBinding<St, Req, Res, Err>
Creates a binding that accepts state per call.
The binding can be used to call the service.
Sourcepub fn bind_state(&self, st: St) -> PipelineBinding<Req, Res, Err>where
St: Clone,
pub fn bind_state(&self, st: St) -> PipelineBinding<Req, Res, Err>where
St: Clone,
Creates a standard pipeline binding by attaching an owned state value.
The binding can be used to call the service.