Function id
pub fn id() -> Id
Available on crate feature
rt only.Returns the Id of the currently running task.
Panics
This function panics if called from outside a task. Please note that calls to block_on do not have task IDs, so the method will panic if called from within a call to block_on. For a version of this function that doesn’t panic, see task::try_id().
MIT License
Copyright © Tokio Contributors
https://docs.rs/tokio/1.53.1/tokio/task/fn.id.html