pub struct PipelineTask { /* private fields */ }Expand description
One running pipeline’s lifecycle handle.
Implementations§
Source§impl PipelineTask
impl PipelineTask
Sourcepub fn new(
pipeline: Pipeline,
params: PipelineTaskParams,
observers: Vec<Arc<dyn FrameObserver>>,
) -> Self
pub fn new( pipeline: Pipeline, params: PipelineTaskParams, observers: Vec<Arc<dyn FrameObserver>>, ) -> Self
Build a task over pipeline with params and external observers.
Sourcepub async fn queue_frame(&self, frame: Frame)
pub async fn queue_frame(&self, frame: Frame)
Queue a downstream frame into the head of the pipeline.
Sourcepub async fn queue_frames(&self, frames: impl IntoIterator<Item = Frame>)
pub async fn queue_frames(&self, frames: impl IntoIterator<Item = Frame>)
Queue several downstream frames.
Sourcepub fn queue_sender(&self) -> UnboundedSender<Frame>
pub fn queue_sender(&self) -> UnboundedSender<Frame>
A clonable handle to the head-injection queue, for an external producer
(e.g. the S2S transport pump) that feeds frames into the pipeline head from
its own task while run drives the pipeline. Sending after the
task finished is a harmless no-op (the receiver is drained on shutdown).
Sourcepub async fn stop_when_done(&self)
pub async fn stop_when_done(&self)
Graceful: queue an End so the pipeline drains then shuts down.
Sourcepub fn has_finished(&self) -> bool
pub fn has_finished(&self) -> bool
Whether the task has finished.
Sourcepub fn cancel_token(&self) -> CancellationToken
pub fn cancel_token(&self) -> CancellationToken
The shared cancellation token (a PipelineRunner
holds it to force-abort on signal).
pub fn on_started(&mut self, f: impl Fn() + Send + Sync + 'static)
pub fn on_finished(&mut self, f: impl Fn(StopReason) + Send + Sync + 'static)
pub fn on_error(&mut self, f: impl Fn(&str, bool) + Send + Sync + 'static)
pub fn on_idle_timeout(&mut self, f: impl Fn() + Send + Sync + 'static)
Auto Trait Implementations§
impl !RefUnwindSafe for PipelineTask
impl !Sync for PipelineTask
impl !UnwindSafe for PipelineTask
impl Freeze for PipelineTask
impl Send for PipelineTask
impl Unpin for PipelineTask
impl UnsafeUnpin for PipelineTask
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more