tokio::task

Function try_id

Source
pub fn try_id() -> Option<Id>
Available on crate feature rt only.
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.