pub enum CancelOutcome<T> {
Completed(T),
Cancelled,
}Expand description
The outcome of a task that races against cancellation.
This enum is returned by spawn_with_cancel variants
to indicate whether the task completed normally or was cancelled.
Variants§
Completed(T)
The task future completed before cancellation was requested.
Cancelled
Cancellation won the race; the task future was dropped.
Implementations§
Source§impl<T> CancelOutcome<T>
impl<T> CancelOutcome<T>
Sourcepub fn outcome(result: Option<T>) -> CancelOutcome<T>
pub fn outcome(result: Option<T>) -> CancelOutcome<T>
Creates a CancelOutcome from an optional result.
§Arguments
result-Some(value)indicates completion,Noneindicates cancellation.
Trait Implementations§
Source§impl<T: Debug> Debug for CancelOutcome<T>
impl<T: Debug> Debug for CancelOutcome<T>
Source§impl<T: PartialEq> PartialEq for CancelOutcome<T>
impl<T: PartialEq> PartialEq for CancelOutcome<T>
impl<T: Eq> Eq for CancelOutcome<T>
impl<T> StructuralPartialEq for CancelOutcome<T>
Auto Trait Implementations§
impl<T> Freeze for CancelOutcome<T>where
T: Freeze,
impl<T> RefUnwindSafe for CancelOutcome<T>where
T: RefUnwindSafe,
impl<T> Send for CancelOutcome<T>where
T: Send,
impl<T> Sync for CancelOutcome<T>where
T: Sync,
impl<T> Unpin for CancelOutcome<T>where
T: Unpin,
impl<T> UnwindSafe for CancelOutcome<T>where
T: UnwindSafe,
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