pub trait Reduce {
type Input;
type FeedProduce;
type Output;
type Error;
// Required methods
fn feed(
&mut self,
item: Self::Input,
) -> Result<Self::FeedProduce, Self::Error>;
fn finalize(self) -> Result<Self::Output, Self::Error>;
}
Expand description
An trait for aggregating items commonly produced in threads into a single result, without itself needing to be thread safe.
Required Associated Types§
sourcetype Input
type Input
The type fed to the reducer in the feed()
method.
It’s produced by a function that may run on multiple threads.
sourcetype FeedProduce
type FeedProduce
sourcetype Output
type Output
The type produced once by the finalize()
method.
For traditional reducers, this is the value produced by the entire operation. For those made for step-wise iteration this may be aggregated statistics.