pub struct WaitGroup(/* private fields */);Expand description
WaitGroup with clonable worker handles.
§Cancellation safety
This future is cancellation safe.
It is also safe to poll again after completion.
let (wg, handle) = WaitGroup::new();
let mut wg = core::pin::pin!(wg);
assert!(!wg.is_done());
handle.done();
wg.as_mut().await;
assert!(wg.is_done());
// It is safe to await again (re-poll)
wg.as_mut().await;
assert!(wg.is_done());Implementations§
Source§impl WaitGroup
impl WaitGroup
Sourcepub fn new() -> (Self, WorkerHandle)
pub fn new() -> (Self, WorkerHandle)
Creates a new WaitGroup and a clonable WorkerHandle.
The WaitGroup is used to await the completion of tasks. The
WorkerHandle is used to signal task completion.
§Examples
use compact_waitgroup::WaitGroup;
let (wg, handle) = WaitGroup::new();
// ... distribute handle ...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 UnsafeUnpin 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
Source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more