pub struct JoinSet<T> { /* private fields */ }Expand description
Same as tokio::task::JoinSet except the number of actively polled futures is limited to a set concurrency.
Does not support spawn_blocking.
For any undocumented methods see tokio::task::JoinSet.
Implementations§
Source§impl<T> JoinSet<T>
impl<T> JoinSet<T>
pub const MAX_CONCURRENCY: usize = 2_305_843_009_213_693_951usize
Sourcepub fn new(concurrency: usize) -> Self
pub fn new(concurrency: usize) -> Self
Creates a new JoinSet with a set concurrency
Panics if concurrency is larger than JoinSet::MAX_CONCURRENCY
pub fn is_empty(&self) -> bool
Sourcepub fn num_active(&self) -> usize
pub fn num_active(&self) -> usize
number of futures actively being polled
Sourcepub fn num_queued(&self) -> usize
pub fn num_queued(&self) -> usize
number of tasks which have been pushed to the join set and are waiting to begin work
Sourcepub fn num_completed(&self) -> usize
pub fn num_completed(&self) -> usize
number of tasks that have already been completed but have not been removed from the join set with join_next
Source§impl<T: 'static> JoinSet<T>
impl<T: 'static> JoinSet<T>
Sourcepub fn spawn<F>(&mut self, task: F) -> AbortHandle
pub fn spawn<F>(&mut self, task: F) -> AbortHandle
Sourcepub fn spawn_on<F>(&mut self, task: F, handle: &Handle) -> AbortHandle
pub fn spawn_on<F>(&mut self, task: F, handle: &Handle) -> AbortHandle
Sourcepub fn spawn_local<F>(&mut self, task: F) -> AbortHandlewhere
F: Future<Output = T> + 'static,
pub fn spawn_local<F>(&mut self, task: F) -> AbortHandlewhere
F: Future<Output = T> + 'static,
Sourcepub fn spawn_local_on<F>(
&mut self,
task: F,
local_set: &LocalSet,
) -> AbortHandlewhere
F: Future<Output = T> + 'static,
pub fn spawn_local_on<F>(
&mut self,
task: F,
local_set: &LocalSet,
) -> AbortHandlewhere
F: Future<Output = T> + 'static,
Sourcepub fn try_join_next(&mut self) -> Option<Result<T, JoinError>>
pub fn try_join_next(&mut self) -> Option<Result<T, JoinError>>
Sourcepub fn detach_all(&mut self)
pub fn detach_all(&mut self)
Sourcepub fn poll_join_next(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Option<Result<T, JoinError>>>
pub fn poll_join_next( &mut self, cx: &mut Context<'_>, ) -> Poll<Option<Result<T, JoinError>>>
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for JoinSet<T>
impl<T> RefUnwindSafe for JoinSet<T>
impl<T> Send for JoinSet<T>where
T: Send,
impl<T> Sync for JoinSet<T>where
T: Send,
impl<T> Unpin for JoinSet<T>
impl<T> UnwindSafe for JoinSet<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more