tokio::task

Function id

Source
pub fn id() -> Id
Available on crate feature rt only.
Expand description

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().