pub struct JoinSet<T> { /* private fields */ }
Expand description
A wrapper around Tokio’s JoinSet that forwards all API calls while optionally
instrumenting spawned tasks and blocking closures with custom tracing behavior.
If no tracer is injected via trace_utils::set_tracer
, tasks and closures are executed
without any instrumentation.
Implementations§
Source§impl<T> JoinSet<T>
impl<T> JoinSet<T>
Sourcepub fn new() -> JoinSet<T>
pub fn new() -> JoinSet<T>
JoinSet::new - Create a new JoinSet.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
JoinSet::len - Return the number of tasks.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
JoinSet::is_empty - Check if the JoinSet is empty.
Source§impl<T> JoinSet<T>where
T: 'static,
impl<T> JoinSet<T>where
T: 'static,
Sourcepub fn spawn<F>(&mut self, task: F) -> AbortHandle
pub fn spawn<F>(&mut self, task: F) -> AbortHandle
JoinSet::spawn - Spawn a new task.
Sourcepub fn spawn_on<F>(&mut self, task: F, handle: &Handle) -> AbortHandle
pub fn spawn_on<F>(&mut self, task: F, handle: &Handle) -> AbortHandle
JoinSet::spawn_on - Spawn a task on a provided runtime.
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,
JoinSet::spawn_local - Spawn a local task.
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,
JoinSet::spawn_local_on - Spawn a local task on a provided LocalSet.
Sourcepub fn spawn_blocking<F>(&mut self, f: F) -> AbortHandle
pub fn spawn_blocking<F>(&mut self, f: F) -> AbortHandle
JoinSet::spawn_blocking - Spawn a blocking task.
Sourcepub fn spawn_blocking_on<F>(&mut self, f: F, handle: &Handle) -> AbortHandle
pub fn spawn_blocking_on<F>(&mut self, f: F, handle: &Handle) -> AbortHandle
JoinSet::spawn_blocking_on - Spawn a blocking task on a provided runtime.
Sourcepub async fn join_next(&mut self) -> Option<Result<T, JoinError>>
pub async fn join_next(&mut self) -> Option<Result<T, JoinError>>
JoinSet::join_next - Await the next completed task.
Sourcepub fn try_join_next(&mut self) -> Option<Result<T, JoinError>>
pub fn try_join_next(&mut self) -> Option<Result<T, JoinError>>
JoinSet::try_join_next - Try to join the next completed task.
Sourcepub fn abort_all(&mut self)
pub fn abort_all(&mut self)
JoinSet::abort_all - Abort all tasks.
Sourcepub fn detach_all(&mut self)
pub fn detach_all(&mut self)
JoinSet::detach_all - Detach all tasks.
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>>>
JoinSet::poll_join_next - Poll for the next completed task.
Sourcepub async fn join_next_with_id(&mut self) -> Option<Result<(Id, T), JoinError>>
pub async fn join_next_with_id(&mut self) -> Option<Result<(Id, T), JoinError>>
JoinSet::join_next_with_id - Await the next completed task with its ID.
Sourcepub fn try_join_next_with_id(&mut self) -> Option<Result<(Id, T), JoinError>>
pub fn try_join_next_with_id(&mut self) -> Option<Result<(Id, T), JoinError>>
JoinSet::try_join_next_with_id - Try to join the next completed task with its ID.
Sourcepub fn poll_join_next_with_id(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Option<Result<(Id, T), JoinError>>>
pub fn poll_join_next_with_id( &mut self, cx: &mut Context<'_>, ) -> Poll<Option<Result<(Id, T), JoinError>>>
JoinSet::poll_join_next_with_id - Poll for the next completed task with its ID.
Sourcepub async fn shutdown(&mut self)
pub async fn shutdown(&mut self)
JoinSet::shutdown - Abort all tasks and wait for shutdown.
Sourcepub async fn join_all(self) -> Vec<T>
pub async fn join_all(self) -> Vec<T>
JoinSet::join_all - Await all tasks.
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> AlignerFor<1> for T
impl<T> AlignerFor<1> for T
Source§impl<T> AlignerFor<1024> for T
impl<T> AlignerFor<1024> for T
Source§type Aligner = AlignTo1024<T>
type Aligner = AlignTo1024<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<128> for T
impl<T> AlignerFor<128> for T
Source§type Aligner = AlignTo128<T>
type Aligner = AlignTo128<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<16> for T
impl<T> AlignerFor<16> for T
Source§impl<T> AlignerFor<16384> for T
impl<T> AlignerFor<16384> for T
Source§type Aligner = AlignTo16384<T>
type Aligner = AlignTo16384<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<2> for T
impl<T> AlignerFor<2> for T
Source§impl<T> AlignerFor<2048> for T
impl<T> AlignerFor<2048> for T
Source§type Aligner = AlignTo2048<T>
type Aligner = AlignTo2048<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<256> for T
impl<T> AlignerFor<256> for T
Source§type Aligner = AlignTo256<T>
type Aligner = AlignTo256<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<32> for T
impl<T> AlignerFor<32> for T
Source§impl<T> AlignerFor<32768> for T
impl<T> AlignerFor<32768> for T
Source§type Aligner = AlignTo32768<T>
type Aligner = AlignTo32768<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<4> for T
impl<T> AlignerFor<4> for T
Source§impl<T> AlignerFor<4096> for T
impl<T> AlignerFor<4096> for T
Source§type Aligner = AlignTo4096<T>
type Aligner = AlignTo4096<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<512> for T
impl<T> AlignerFor<512> for T
Source§type Aligner = AlignTo512<T>
type Aligner = AlignTo512<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<64> for T
impl<T> AlignerFor<64> for T
Source§impl<T> AlignerFor<8> for T
impl<T> AlignerFor<8> for T
Source§impl<T> AlignerFor<8192> for T
impl<T> AlignerFor<8192> for T
Source§type Aligner = AlignTo8192<T>
type Aligner = AlignTo8192<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<S> ROExtAcc for S
impl<S> ROExtAcc for S
Source§fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
offset
. Read moreSource§fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
offset
. Read moreSource§fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
offset
. Read moreSource§fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
offset
. Read moreSource§impl<S> ROExtOps<Aligned> for S
impl<S> ROExtOps<Aligned> for S
Source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
offset
) with value
,
returning the previous value of the field. Read moreSource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
Source§impl<S> ROExtOps<Unaligned> for S
impl<S> ROExtOps<Unaligned> for S
Source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
offset
) with value
,
returning the previous value of the field. Read moreSource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
Source§impl<T> SelfOps for Twhere
T: ?Sized,
impl<T> SelfOps for Twhere
T: ?Sized,
Source§fn piped<F, U>(self, f: F) -> U
fn piped<F, U>(self, f: F) -> U
Source§fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
piped
except that the function takes &Self
Useful for functions that take &Self
instead of Self
. Read moreSource§fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
piped
, except that the function takes &mut Self
.
Useful for functions that take &mut Self
instead of Self
.Source§fn mutated<F>(self, f: F) -> Self
fn mutated<F>(self, f: F) -> Self
Source§fn observe<F>(self, f: F) -> Self
fn observe<F>(self, f: F) -> Self
Source§fn as_ref_<T>(&self) -> &T
fn as_ref_<T>(&self) -> &T
AsRef
,
using the turbofish .as_ref_::<_>()
syntax. Read more