pub struct Pipeline<Req, Res, Err> { /* private fields */ }Expand description
Container for a service.
Provides a way to call the enclosed service and share its readiness state.
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>(f: impl IntoService<S, St, Req>) -> Pipeline<Req, Res, Err>
pub fn new<S, St>(f: impl IntoService<S, St, Req>) -> Pipeline<Req, Res, Err>
Construct new service pipeline instance with default state.
Sourcepub fn with<S, St>(
st: St,
f: impl IntoService<S, St, Req>,
) -> Pipeline<Req, Res, Err>where
S: Service<St, Req, Res = Res, Error = Err> + 'static,
St: 'static,
pub fn with<S, St>(
st: St,
f: impl IntoService<S, St, Req>,
) -> Pipeline<Req, Res, Err>where
S: Service<St, Req, Res = Res, Error = Err> + 'static,
St: 'static,
Construct new service pipeline instance with state.
Sourcepub fn with_ctl<S, St, Ctl>(
st: St,
ctl: Ctl,
f: impl IntoService<S, St, Req>,
) -> Pipeline<Req, Res, Err>
pub fn with_ctl<S, St, Ctl>( st: St, ctl: Ctl, f: impl IntoService<S, St, Req>, ) -> Pipeline<Req, Res, Err>
Construct new service pipeline instance with state.
Sourcepub async fn ready(&self) -> Result<(), Err>
pub async fn ready(&self) -> Result<(), Err>
Returns when the pipeline is ready to process requests.
Sourcepub async fn call(&self, req: Req) -> Result<Res, Err>
pub async fn call(&self, req: Req) -> Result<Res, Err>
Wait for service readiness, then create a future that resolves to the service call result.
Sourcepub fn call_static(&self, req: Req) -> PipelineCall<Req, Res, Err> ⓘ
pub fn call_static(&self, req: Req) -> PipelineCall<Req, Res, Err> ⓘ
Wait for service readiness, then create a future that resolves to the service result.
This call can be completed from different async tasks.
Sourcepub fn call_nowait(&self, req: Req) -> PipelineCall<Req, Res, Err> ⓘ
pub fn call_nowait(&self, req: Req) -> PipelineCall<Req, Res, Err> ⓘ
Call the service and create a future that resolves to the service result.
This call can be completed from different async tasks. Note: this call does not check service readiness.
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.
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>
Returns the current pipeline binding.
The binding can be used to check readiness and call the service.