[][src]Trait workpool::Pool

pub trait Pool<I> {
    type Output;
    type WaitHandle: WaitHandle<Output = Self::Output>;
    fn add(&self, input: I);
fn wait_handle(self) -> Self::WaitHandle;
fn wait(self) -> Self::Output; }

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.

Associated Types

type Output

type WaitHandle: WaitHandle<Output = Self::Output>

Loading content...

Required methods

fn add(&self, input: I)

fn wait_handle(self) -> Self::WaitHandle

fn wait(self) -> Self::Output

Loading content...

Implementors

impl<I, W, R> Pool<I> for DynamicPool<I, W, R> where
    W: Worker<I>,
    R: Reducer<W::Output>, 
[src]

type Output = R::Output

type WaitHandle = WaitHandle<R::Output>

impl<I, W, R> Pool<I> for StaticPool<I, W, R> where
    I: Send + 'static,
    W: Worker<I> + Send + Sync + 'static,
    R: Reducer<W::Output> + Send + 'static,
    R::Output: Send + Sync
[src]

type Output = R::Output

type WaitHandle = WaitHandle<R::Output>

Loading content...