pub struct Pipeline { /* private fields */ }Expand description
An ordered chain of stages that run inline on one task.
Implementations§
Source§impl Pipeline
impl Pipeline
pub fn new(meta: PipelineMeta, stages: Vec<Box<dyn Plugin>>) -> Self
Sourcepub fn with_names(
meta: PipelineMeta,
stages: Vec<Box<dyn Plugin>>,
names: Vec<String>,
) -> Self
pub fn with_names( meta: PipelineMeta, stages: Vec<Box<dyn Plugin>>, names: Vec<String>, ) -> Self
As Pipeline::new, but with display names that may differ from the
plugin names: aliases, or #n suffixes for repeated plugins.
pub fn meta(&self) -> &PipelineMeta
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn stage_names(&self) -> impl Iterator<Item = &str>
Sourcepub fn tick_interval(&self) -> Option<Duration>
pub fn tick_interval(&self) -> Option<Duration>
How often the host should ask this pipeline for ticks, or None when
no stage wants any.
The shortest period any stage asked for. A stage that wanted a longer one is simply not due on most of those wakeups, which is cheaper than a timer each.
Sourcepub fn tick<'p>(
&'p mut self,
now: Instant,
sink: &mut dyn EffectSink,
) -> Result<Option<Emitted<'p>>>
pub fn tick<'p>( &'p mut self, now: Instant, sink: &mut dyn EffectSink, ) -> Result<Option<Emitted<'p>>>
Give one due stage its tick, and return what reached the end of the pipeline.
None means nothing was due. Call it again until it says so: two
stages can come due on the same wakeup, and each one’s output has to be
written before the next runs.
Unlike process and finish
this does not run every stage. A tick belongs to one of them, and what
it emits cascades through the stages below it only, the ones above
are upstream of a chunk that did not come from them.
Sourcepub fn datagram_hazard(&self) -> Option<&str>
pub fn datagram_hazard(&self) -> Option<&str>
The first stage that must not carry datagrams, if any.
Sourcepub fn declarations(&self) -> impl Iterator<Item = Declaration<'_>>
pub fn declarations(&self) -> impl Iterator<Item = Declaration<'_>>
What every stage does to boundaries and what it needs of them, in order.
Read once at build time. A Chain folds these across its segments to
answer whether each requiring stage got what it asked for.
Sourcepub fn process<'p>(
&'p mut self,
input: &'p [u8],
sink: &mut dyn EffectSink,
) -> Result<Emitted<'p>>
pub fn process<'p>( &'p mut self, input: &'p [u8], sink: &mut dyn EffectSink, ) -> Result<Emitted<'p>>
Push one chunk through every stage.
The result borrows input directly when every stage passed it through,
and carries the framing of whatever reframed it otherwise.
Sourcepub fn finish<'p>(
&'p mut self,
sink: &mut dyn EffectSink,
) -> Result<Emitted<'p>>
pub fn finish<'p>( &'p mut self, sink: &mut dyn EffectSink, ) -> Result<Emitted<'p>>
Signal EOF, cascading each stage’s final bytes through the ones below.