From 4d0d89fb70d7e093c5401d0f8241275db673e70d Mon Sep 17 00:00:00 2001 From: teor Date: Wed, 3 Jul 2024 01:54:59 +1000 Subject: [PATCH] task: document behavior of `JoinSet::try_join_next` when all tasks are running (#6671) --- tokio/src/task/join_set.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tokio/src/task/join_set.rs b/tokio/src/task/join_set.rs index 267ceb55bcc..612e53addb3 100644 --- a/tokio/src/task/join_set.rs +++ b/tokio/src/task/join_set.rs @@ -308,7 +308,7 @@ impl JoinSet { /// Tries to join one of the tasks in the set that has completed and return its output. /// - /// Returns `None` if the set is empty. + /// Returns `None` if there are no completed tasks, or if the set is empty. pub fn try_join_next(&mut self) -> Option> { // Loop over all notified `JoinHandle`s to find one that's ready, or until none are left. loop { @@ -331,7 +331,7 @@ impl JoinSet { /// Tries to join one of the tasks in the set that has completed and return its output, /// along with the [task ID] of the completed task. /// - /// Returns `None` if the set is empty. + /// Returns `None` if there are no completed tasks, or if the set is empty. /// /// When this method returns an error, then the id of the task that failed can be accessed /// using the [`JoinError::id`] method.