Struct pipeliner::PipelineBuilder
source · Expand description
This is an intermediate data structure which allows you to configure how your pipeline should run.
Implementations
sourceimpl<I> PipelineBuilder<I>where
I: Iterator + Send + 'static,
I::Item: Send + 'static,
impl<I> PipelineBuilder<I>where
I: Iterator + Send + 'static,
I::Item: Send + 'static,
sourcepub fn num_threads(self, num_threads: usize) -> Self
pub fn num_threads(self, num_threads: usize) -> Self
Set how many worker threads should be used to perform this work. A value of 0 is interpreted as 1.
sourcepub fn out_buffer(self, size: usize) -> Self
pub fn out_buffer(self, size: usize) -> Self
Set how many output values to cache. The default, 0, results in synchronous output. Note that in effect each thread caches its output as it waits to send it, so in many cases you may not need additional output buffering.
sourcepub fn map<F, Out>(self, callable: F) -> impl Iterator<Item = Out>where
Out: Send + 'static,
F: Fn(I::Item) -> Out + Send + Sync + 'static,
pub fn map<F, Out>(self, callable: F) -> impl Iterator<Item = Out>where
Out: Send + 'static,
F: Fn(I::Item) -> Out + Send + Sync + 'static,
Apply callable
to items from the input Iterator and make them
available via the output iterator.
Note that the order of items in the output Iterator may not match
the order of the input iterator. (They’re returned as soon as callable
produces a result.) For ordered (but slower) iteration, use
ordered_map()
.
sourcepub fn ordered_map<F, Out>(self, callable: F) -> impl Iterator<Item = Out>where
Out: Send + 'static,
F: Fn(I::Item) -> Out + Send + Sync + 'static,
pub fn ordered_map<F, Out>(self, callable: F) -> impl Iterator<Item = Out>where
Out: Send + 'static,
F: Fn(I::Item) -> Out + Send + Sync + 'static,
Like map()
, but does some extra work to ensure that results in the
output match the order of their inputs from the input Iterator.
This requires a bit more work, and may introduce head-of-line blocking
which may affect performance. If you don’t require ordered results,
prefer using map()
.