[−][src]Struct easy_parallel::Parallel
A builder that runs closures in parallel.
Implementations
impl<'a> Parallel<'a>
[src]
pub fn new() -> Parallel<'a>
[src]
Creates a builder for running closures in parallel.
Examples
use easy_parallel::Parallel; let p = Parallel::new();
pub fn add<F>(self, f: F) -> Parallel<'a> where
F: FnOnce() + Send + 'a,
[src]
F: FnOnce() + Send + 'a,
Adds a closure to the list.
Examples
use easy_parallel::Parallel; Parallel::new() .add(|| println!("hello from a thread")) .run();
pub fn each<T, I, F>(self, iter: I, f: F) -> Parallel<'a> where
I: IntoIterator<Item = T>,
F: FnOnce(T) + Clone + Send + 'a,
T: Send + 'a,
[src]
I: IntoIterator<Item = T>,
F: FnOnce(T) + Clone + Send + 'a,
T: Send + 'a,
Adds a cloned closure for each item in an iterator.
Each clone of the closure takes an item as an argument.
Examples
use easy_parallel::Parallel; Parallel::new() .each(0..5, |i| println!("thread #{}", i)) .run();
pub fn run(self)
[src]
Spawns a thread for each closure and waits from them to complete.
If a closure panics, panicking will resume in the main thread after all threads are joined.
Examples
use easy_parallel::Parallel; Parallel::new() .add(|| println!("thread #1")) .add(|| println!("thread #2")) .run();
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Parallel<'a>
impl<'a> Send for Parallel<'a>
impl<'a> !Sync for Parallel<'a>
impl<'a> Unpin for Parallel<'a>
impl<'a> !UnwindSafe for Parallel<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,