pub struct PipelineBinding<Req, Res, Err> { /* private fields */ }Expand description
An independently registered handle to a Pipeline.
Bindings share the pipeline and its readiness state. Cloning a binding registers another handle.
Implementations§
Source§impl<Req, Res, Err> PipelineBinding<Req, Res, Err>where
Req: 'static,
Res: 'static,
Err: 'static,
impl<Req, Res, Err> PipelineBinding<Req, Res, Err>where
Req: 'static,
Res: 'static,
Err: 'static,
Sourcepub fn ready(&self) -> impl Future<Output = Result<(), Err>>
pub fn ready(&self) -> impl Future<Output = Result<(), Err>>
Waits until the pipeline is ready to process a request.
Reuses valid shared readiness without consuming it or allocating a
readiness future. Returns successfully if pipeline shutdown has
started, like Pipeline::ready.
The first caller that finds readiness invalid runs the shared check in its own future, and other waiters wait for it. Like a held lock, a pending future must be polled or dropped: keeping it alive without polling stalls every other readiness waiter on this pipeline.
Sourcepub fn is_shutdown(&self) -> bool
pub fn is_shutdown(&self) -> bool
Checks whether pipeline shutdown has been initiated.
Sourcepub fn call(&self, req: Req) -> impl Future<Output = Result<Res, Err>>
pub fn call(&self, req: Req) -> impl Future<Output = Result<Res, Err>>
Waits for readiness, then calls the service.
Reuses valid shared readiness without consuming it. Calls are forwarded
even after shutdown has started; see Pipeline.
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.
The returned future does not borrow this binding and can be moved between local tasks. Shared readiness is consulted when the future is polled and the call is dispatched, not when the future is constructed.
Sourcepub fn on_notify(&self, callback: &ReadyCallback)
pub fn on_notify(&self, callback: &ReadyCallback)
Registers a callback on the shared pipeline scope.
The callback receives 0 for this root scope.
Dropping this binding does not remove the registration.
See Pipeline::on_notify and ReadyCallback for details.
Sourcepub fn bind_to(&self, ctx: &BindCtx<'_>)
pub fn bind_to(&self, ctx: &BindCtx<'_>)
Registers this handle’s pipeline as a readiness dependency.
Call from Service::bind. See Pipeline::bind_to for details.
Sourcepub fn readiness_link(&self) -> ReadyLink
pub fn readiness_link(&self) -> ReadyLink
Returns the shared pipeline’s readiness endpoint.
See Pipeline::readiness_link and ReadyLink.
Trait Implementations§
Source§impl<Req, Res, Err> Clone for PipelineBinding<Req, Res, Err>
impl<Req, Res, Err> Clone for PipelineBinding<Req, Res, Err>
Source§fn clone(&self) -> PipelineBinding<Req, Res, Err>
fn clone(&self) -> PipelineBinding<Req, Res, Err>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more