pub trait Pool<I> {
type Output;
type WaitHandle: WaitHandle<Output = Self::Output>;
// Required methods
fn add(&self, input: I);
fn wait_handle(self) -> Self::WaitHandle;
fn wait(self) -> Self::Output;
}
Expand description
Pool allows for parallel processing of items. When creating a pool a Worker
and Reducer
are provided. The worker accepts input and produces one output
value for every input value. The reducer reduces the output from the worker
into a single resulting value. Once created you can add input values to the
pool using add()
. Once all input has been added you can invoke either
wait()
or wait_handle()
to wait for all input to be processed and
retrieve the reduced output value.