pub struct MonoWaitGroup(/* private fields */);Expand description
WaitGroup with a single non-clonable worker handle.
§Cancellation safety
This future is cancellation safe.
It is also safe to poll again after completion.
let (wg, handle) = MonoWaitGroup::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 MonoWaitGroup
impl MonoWaitGroup
Sourcepub fn new() -> (Self, MonoWorkerHandle)
pub fn new() -> (Self, MonoWorkerHandle)
Creates a new MonoWaitGroup and a single MonoWorkerHandle.
This variant is optimized for scenarios where there is exactly one worker task. The handle cannot be cloned.
§Examples
use compact_waitgroup::MonoWaitGroup;
let (wg, handle) = MonoWaitGroup::new();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<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