pub struct WaitGroup(/* private fields */);Expand description
WaitGroup with clonable group tokens.
§Cancellation safety
This future is cancellation safe.
It is also safe to poll again after completion.
let (wg, token) = WaitGroup::new();
let mut wg = core::pin::pin!(wg);
assert!(!wg.is_done());
token.release();
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, GroupTokenFactory)
pub fn new() -> (Self, GroupTokenFactory)
Creates a new WaitGroup and a GroupTokenFactory.
Sourcepub fn is_done(&self) -> bool
pub fn is_done(&self) -> bool
Checks if the WaitGroup has completed.
This returns true if all GroupTokens have been dropped.
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<T, F> GroupTokenExt<T> for Fwhere
T: GroupTokenType,
F: Future,
impl<T, F> GroupTokenExt<T> for Fwhere
T: GroupTokenType,
F: Future,
Source§fn release_on_ready(self, token: T) -> GroupTokenReleaseOnReady<Self, T> ⓘ
fn release_on_ready(self, token: T) -> GroupTokenReleaseOnReady<Self, T> ⓘ
Releases the group token when the future is ready or dropped.
Source§fn release_on_drop(self, token: T) -> GroupTokenReleaseOnDrop<Self, T> ⓘ
fn release_on_drop(self, token: T) -> GroupTokenReleaseOnDrop<Self, T> ⓘ
Releases the group token when the future is dropped. 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