1#![forbid(unsafe_code)]
7
8use inspect::Inspect;
9use pal_async::task::TaskData;
10use pal_async::task::TaskList;
11
12struct Wrap(Vec<TaskData>);
13
14impl Inspect for Wrap {
15 fn inspect(&self, req: inspect::Request<'_>) {
16 let mut resp = req.respond();
17 for task in &self.0 {
18 resp.child(&task.id().to_string(), |req| {
19 req.respond()
20 .field("name", task.name())
21 .field("executor", task.executor())
22 .display("state", &task.state())
23 .field(
24 "location",
25 format!("{}:{}", task.location().file(), task.location().line()),
26 );
27 });
28 }
29 }
30}
31
32pub fn inspect_task_list() -> impl Inspect {
35 Wrap(TaskList::global().tasks())
36}