This commit is contained in:
Miles Silberling-Cook 2025-07-18 15:21:13 +02:00 committed by GitHub
commit d3fbe6f652
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -31,6 +31,12 @@ impl<T: 'static> Task<T> {
/// This is only included for feature parity with other platforms.
pub fn detach(self) {}
/// Returns true if the current task is finished.
pub fn is_finished(&self) -> bool {
// Returns true if the result is ready or has already been accessed.
!self.0.is_empty() || self.0.is_terminated()
}
/// Requests a task to be cancelled and returns a future that suspends until it completes.
/// Returns the output of the future if it has already completed.
///