Skip to main content

Pipeline

Struct Pipeline 

Source
pub struct Pipeline { /* private fields */ }
Expand description

An ordered chain of stages that run inline on one task.

Implementations§

Source§

impl Pipeline

Source

pub fn new(meta: PipelineMeta, stages: Vec<Box<dyn Plugin>>) -> Self

Source

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.

Source

pub fn meta(&self) -> &PipelineMeta

Source

pub fn is_empty(&self) -> bool

Source

pub fn len(&self) -> usize

Source

pub fn stage_names(&self) -> impl Iterator<Item = &str>

Source

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.

Source

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.

Source

pub fn datagram_hazard(&self) -> Option<&str>

The first stage that must not carry datagrams, if any.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for Pipeline

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.