tokio::task

Function try_id

Source
pub fn try_id() -> Option<Id>
Expand description

Returns the Id of the currently running task, or None if called outside of a task.

This function is similar to task::id(), except that it returns None rather than panicking if called outside of a task context.