From 0c1facdc73ea6eefaa0ca92441f65c19ad480763 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Mon, 30 Nov 2026 15:13:57 -0800 Subject: [PATCH] actually add the accessors --- src/lib.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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