task: document behavior of JoinSet::try_join_next when all tasks are running (#6671)

This commit is contained in:
teor 2024-07-03 01:54:59 +10:00 committed by GitHub
parent fe7285d3d1
commit 4d0d89fb70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -308,7 +308,7 @@ impl<T: 'static> JoinSet<T> {
/// 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<Result<T, JoinError>> {
// Loop over all notified `JoinHandle`s to find one that's ready, or until none are left.
loop {
@ -331,7 +331,7 @@ impl<T: 'static> JoinSet<T> {
/// 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.