pub struct MonoWaitGroup(/* private fields */);Expand description
WaitGroup with a single non-clonable group token.
This variant is optimized for scenarios where there is exactly one worker task, and the group token cannot be cloned.
§Cancellation safety
This future is cancellation safe.
It is also safe to poll again after completion.
let (wg, token) = MonoWaitGroup::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 MonoWaitGroup
impl MonoWaitGroup
Sourcepub fn new() -> (Self, MonoGroupToken)
pub fn new() -> (Self, MonoGroupToken)
Creates a new MonoWaitGroup and a single MonoGroupToken.
Sourcepub fn is_done(&self) -> bool
pub fn is_done(&self) -> bool
Checks if the MonoWaitGroup has completed.
This returns true if the MonoGroupToken has been dropped.
Trait Implementations§
Source§impl Debug for MonoWaitGroup
impl Debug for MonoWaitGroup
Source§impl Future for MonoWaitGroup
impl Future for MonoWaitGroup
Auto Trait Implementations§
impl Freeze for MonoWaitGroup
impl RefUnwindSafe for MonoWaitGroup
impl Send for MonoWaitGroup
impl Sync for MonoWaitGroup
impl Unpin for MonoWaitGroup
impl UnsafeUnpin for MonoWaitGroup
impl UnwindSafe for MonoWaitGroup
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