pub struct Id(/* private fields */);
Expand description
An opaque ID that uniquely identifies a task relative to all other currently running tasks.
A task’s ID may be re-used for another task only once both of the following happen:
- The task itself exits.
- There is no active
JoinHandle
associated with this task.
A JoinHandle
is considered active in the following situations:
- You are explicitly holding a
JoinHandle
,AbortHandle
, ortokio_util::task::AbortOnDropHandle
. - The task is being tracked by a
JoinSet
ortokio_util::task::JoinMap
.
§Notes
- Task IDs are not sequential, and do not indicate the order in which tasks are spawned, what runtime a task is spawned on, or any other data.
- The task ID of the currently running task can be obtained from inside the
task via the
task::try_id()
andtask::id()
functions and from outside the task via theJoinHandle::id()
function.
Trait Implementations§
Source§impl Ord for Id
impl Ord for Id
Source§impl PartialOrd for Id
impl PartialOrd for Id
impl Copy for Id
impl Eq for Id
impl StructuralPartialEq for Id
Auto Trait Implementations§
impl Freeze for Id
impl RefUnwindSafe for Id
impl Send for Id
impl Sync for Id
impl Unpin for Id
impl UnwindSafe for Id
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