pub struct ParallelMapper<Input, Output, Map>where
Input: Send + 'static,
Output: Send + 'static,
Map: Fn(Input) -> Output + Send + Sync + 'static,{ /* private fields */ }Implementations§
Source§impl<Input, Output, Map> ParallelMapper<Input, Output, Map>
impl<Input, Output, Map> ParallelMapper<Input, Output, Map>
pub fn new(max_workers: u32, map: Map) -> Self
pub fn concurrency(&self) -> u32
pub fn push(&mut self, input: Input)
Sourcepub fn pop_result(&mut self) -> Option<Output>
pub fn pop_result(&mut self) -> Option<Output>
Pops and returns result if any
Sourcepub fn process_all<I>(&mut self, inputs: I) -> Vec<Output>
pub fn process_all<I>(&mut self, inputs: I) -> Vec<Output>
Processes the provided inputs in parallel.
§Ordering
The order of outputs is not guaranteed to match the input order. Outputs are returned in completion order.
pub fn wait(&self)
pub fn finish(&mut self) -> Vec<Output>
Trait Implementations§
Auto Trait Implementations§
impl<Input, Output, Map> Freeze for ParallelMapper<Input, Output, Map>
impl<Input, Output, Map> !RefUnwindSafe for ParallelMapper<Input, Output, Map>
impl<Input, Output, Map> Send for ParallelMapper<Input, Output, Map>
impl<Input, Output, Map> Sync for ParallelMapper<Input, Output, Map>
impl<Input, Output, Map> Unpin for ParallelMapper<Input, Output, Map>
impl<Input, Output, Map> UnsafeUnpin for ParallelMapper<Input, Output, Map>
impl<Input, Output, Map> !UnwindSafe for ParallelMapper<Input, Output, Map>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more