[][src]Struct workpool::dynamic_pool::DynamicPool

pub struct DynamicPool<I, W, R> where
    W: Worker<I>,
    R: Reducer<W::Output>, 
{ /* fields omitted */ }

DynamicPool is a Pool that can dynamically adjust the number of threads at runtime.

Methods

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

pub fn set_concurrency_limit(&self, concurrency_limit: i64)[src]

Adjust the concurrency_limit. Only this many work items will be processed concurrently. If the pool is currently processing more than the new limit's amount of work the current work will finish processing until the amount of concurrenct work drops below the new threshold.

pub fn add(&self, input: I)[src]

Add a work item to be done by the pool.

pub fn wait_handle(self) -> WaitHandle<R::Output>[src]

Return a wait handle. This indicates that no new work will be added to the pool and wait() can be invoked on the returned handle to wait for all input to be processed and retrieve the output value.

pub fn wait(self) -> R::Output[src]

Wait for all input to be processed and return the output value.

Trait Implementations

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: Debug, W: Debug, R: Debug> Debug for DynamicPool<I, W, R> where
    W: Worker<I>,
    R: Reducer<W::Output>,
    R::Output: Debug
[src]

Auto Trait Implementations

impl<I, W, R> Send for DynamicPool<I, W, R> where
    I: Send,
    <R as Reducer<<W as Worker<I>>::Output>>::Output: Send + Sync

impl<I, W, R> Sync for DynamicPool<I, W, R> where
    I: Send,
    <R as Reducer<<W as Worker<I>>::Output>>::Output: Send + Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T