Skip to content

Commit 230b0a4

Browse files
authored
Add FallibleTask::is_finished() (#34)
1 parent a3b235d commit 230b0a4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/task.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,13 @@ impl<T> FallibleTask<T> {
513513
pub async fn cancel(self) -> Option<T> {
514514
self.task.cancel().await
515515
}
516+
517+
/// Returns `true` if the current task is finished.
518+
///
519+
/// Note that in a multithreaded environment, this task can change finish immediately after calling this function.
520+
pub fn is_finished(&self) -> bool {
521+
self.task.is_finished()
522+
}
516523
}
517524

518525
impl<T> Future for FallibleTask<T> {

0 commit comments

Comments
 (0)