diff --git a/src/lib.rs b/src/lib.rs index dd34baa..b3216b9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -242,6 +242,25 @@ impl ParallelTaskSet { pub async fn join_remaining(self) -> Vec { self.set.join_all().await } + + /// Returns the number of tasks currently in this set. + pub fn len(&self) -> usize { + self.set.len() + } + + /// Returns `true` if this set is currently empty. + pub fn is_empty(&self) -> bool { + self.set.is_empty() + } + + /// Returns the maximum number of tasks that may be on this set at any given + /// time. + /// + /// See [the type-level documentation](ParallelTaskSet#limiting-parallelism) + /// for more details. + pub fn max_parallelism(&self) -> NonZeroUsize { + self.max_parallelism + } } /// An iterator over the outputs of completed tasks, returned by