pub struct WaitGroup { /* private fields */ }
Expand description
A WaitGroup waits for a collection of coroutines to finish.
§Examples
use rust_waitgroup::WaitGroup;
use std::thread;
let wg = WaitGroup::default();
let n = 10;
for _ in 0..n {
let wg = wg.clone();
wg.add(1);
thread::spawn(move || {
// do some work
wg.done();
});
}
wg.wait();
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WaitGroup
impl RefUnwindSafe for WaitGroup
impl Send for WaitGroup
impl Sync for WaitGroup
impl Unpin for WaitGroup
impl UnwindSafe for WaitGroup
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