pub struct Id(/* 私有字段 */);展开描述
唯一标识一个任务(相对于所有其他当前正在运行的任务)的不透明 ID。
仅在同时满足以下两个条件时,任务的 ID 才能被另一个任务重用:
- The task itself exits.
- There is no active
JoinHandleassociated with this task.
在以下情况下,JoinHandle 被视为活动状态:
- You are explicitly holding a
JoinHandle,AbortHandle, ortokio_util::task::AbortOnDropHandle. - The task is being tracked by a
JoinSetortokio_util::task::JoinMap.
§注意
- 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 实现§
源代码§impl Ord for Id
impl Ord for Id
源代码§impl PartialOrd for Id
impl PartialOrd for Id
impl Copy for Id
impl Eq for Id
impl StructuralPartialEq for Id
自动 trait 实现§
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 实现§
源代码§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
源代码§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. 更多信息