Struct Id
pub struct Id(/* private field */);
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
JoinHandleassociated 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
JoinSetortokio_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
impl Clone for Id
fn clone(&self) -> Self
impl Copy for Id
impl Debug for Id
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Display for Id
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for Id
impl Hash for Id
fn hash<__H: Hasher>(&self, state: &mut __H)
impl Ord for Id
fn cmp(&self, other: &Self) -> Ordering
impl PartialEq for Id
fn eq(&self, other: &Self) -> bool
impl PartialOrd for Id
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
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 UnsafeUnpin for Id
impl UnwindSafe for Id
Blanket Implementations
impl<T> Any for Id
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Id
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Id
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Id
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Id
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Id
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T> ToString for Id
where
T: Display + ?Sized,
fn to_string(&self) -> String
impl<T, U> Into<U> for Id
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Id
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Id
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>