pub struct Id(/* private fields */);展开描述
一个不透明的 ID,用于在所有当前运行的 task 中唯一标识某个 task。
一个任务的 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.
§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 实现§
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
自动 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 实现§
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. 更多信息