pub struct PipelineBuilder<T: 'static> { /* private fields */ }Expand description
Builder for constructing a stream processing pipeline.
Start with Pipeline::from_source, chain transforms with .map()
and .filter(), then terminate with .sink(), .fold(), or
.collect().
Implementations§
Source§impl<T: Serialize + DeserializeOwned + 'static> PipelineBuilder<T>
impl<T: Serialize + DeserializeOwned + 'static> PipelineBuilder<T>
Sourcepub fn map<U, F>(self, f: F) -> PipelineBuilder<U>
pub fn map<U, F>(self, f: F) -> PipelineBuilder<U>
Apply a map transformation to each item.
The closure receives each item and returns a transformed item. The output type must be serializable for inter-stage buffering.
Sourcepub fn filter<F>(self, pred: F) -> PipelineBuilder<T>
pub fn filter<F>(self, pred: F) -> PipelineBuilder<T>
Filter items by a predicate. Items for which the predicate returns
false are dropped.
Sourcepub fn on_node(self, constraint: NodeConstraint) -> Self
pub fn on_node(self, constraint: NodeConstraint) -> Self
Set a placement constraint for the next stage.
Sourcepub fn buffer_size(self, n: usize) -> Self
pub fn buffer_size(self, n: usize) -> Self
Set the inter-stage buffer capacity for the next stage boundary.
Sourcepub fn sink<K: Sink<T> + 'static>(self, sink: K) -> SinkPipeline<T, K>
pub fn sink<K: Sink<T> + 'static>(self, sink: K) -> SinkPipeline<T, K>
Terminate the pipeline with a sink, then call .run() to execute.
Sourcepub fn fold<Acc, F>(self, init: Acc, f: F) -> FoldPipeline<T, Acc, F>where
F: FnMut(Acc, T) -> Acc,
pub fn fold<Acc, F>(self, init: Acc, f: F) -> FoldPipeline<T, Acc, F>where
F: FnMut(Acc, T) -> Acc,
Terminate the pipeline with a fold, then call .run() to execute.
Sourcepub fn collect(self) -> CollectPipeline<T>
pub fn collect(self) -> CollectPipeline<T>
Convenience: terminate with a collect and call .run() to get items.
Sourcepub fn build(self) -> Result<PipelineHandle<T>, FabricError>
pub fn build(self) -> Result<PipelineHandle<T>, FabricError>
Build the pipeline into a handle that can be run.