Add FallibleTask::is_finished() (#34)

This commit is contained in:
Mark Logan 2022-10-03 12:53:50 -07:00 committed by GitHub
parent a3b235d32a
commit 230b0a4c84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -513,6 +513,13 @@ impl<T> FallibleTask<T> {
pub async fn cancel(self) -> Option<T> {
self.task.cancel().await
}
/// Returns `true` if the current task is finished.
///
/// Note that in a multithreaded environment, this task can change finish immediately after calling this function.
pub fn is_finished(&self) -> bool {
self.task.is_finished()
}
}
impl<T> Future for FallibleTask<T> {