pub enum ReadyOrNot<F: Future> {
Ready(F::Output),
Not(F),
}Expand description
This type holds a future that has been detached from a group.
Variants§
Ready(F::Output)
If the future has run to completion, this variant holds the future’s output.
Not(F)
If the future has not yet run to completion, this variant holds the future.
Implementations§
Source§impl<F: Future> ReadyOrNot<F>
impl<F: Future> ReadyOrNot<F>
Sourcepub async fn output(self) -> F::Output
pub async fn output(self) -> F::Output
A convenience method for retrieving the output of the future, either by driving the contained future to completion or by unwrapping the output value.
Note that this method does not drive the background futures of an async group. To drive the background
futures, use Group::detach_and_wait_for instead of detaching the future separately.
Trait Implementations§
impl<F: Eq + Future> Eq for ReadyOrNot<F>
Source§impl<F: Ord + Future> Ord for ReadyOrNot<F>
impl<F: Ord + Future> Ord for ReadyOrNot<F>
Source§fn cmp(&self, other: &ReadyOrNot<F>) -> Ordering
fn cmp(&self, other: &ReadyOrNot<F>) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<F: PartialEq + Future> PartialEq for ReadyOrNot<F>
impl<F: PartialEq + Future> PartialEq for ReadyOrNot<F>
Source§fn eq(&self, other: &ReadyOrNot<F>) -> bool
fn eq(&self, other: &ReadyOrNot<F>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<F: PartialOrd + Future> PartialOrd for ReadyOrNot<F>where
F::Output: PartialOrd,
impl<F: PartialOrd + Future> PartialOrd for ReadyOrNot<F>where
F::Output: PartialOrd,
impl<F: Future> StructuralPartialEq for ReadyOrNot<F>
Auto Trait Implementations§
impl<F> Freeze for ReadyOrNot<F>
impl<F> RefUnwindSafe for ReadyOrNot<F>
impl<F> Send for ReadyOrNot<F>
impl<F> Sync for ReadyOrNot<F>
impl<F> Unpin for ReadyOrNot<F>
impl<F> UnsafeUnpin for ReadyOrNot<F>
impl<F> UnwindSafe for ReadyOrNot<F>
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