Function async_std::task::current

source ·
pub fn current() -> Task
Expand description

Returns a handle to the current task.

Panics

This function will panic if not called within the context of a task created by block_on, spawn, or Builder::spawn.

Examples

use async_std::task;

println!("The name of this task is {:?}", task::current().name());