spawn_tracked

Function spawn_tracked 

Source
pub fn spawn_tracked<F, T>(name: T, future: F) -> JoinHandle<F::Output>
where F: Future + Send + 'static, F::Output: Send + 'static, T: Into<String>,
Expand description

Spawn a tracked task on the async-std runtime

This function spawns a task and automatically tracks it in the global Inspector.

ยงExamples

use async_inspect::runtime::async_std::spawn_tracked;

async_std::task::block_on(async {
    let handle = spawn_tracked("my_task", async {
        // Your async code here
        42
    });

    let result = handle.await;
    println!("Result: {}", result);
});