use inspect::Inspect;
use pal_async::task::TaskData;
use pal_async::task::TaskList;
struct Wrap(Vec<TaskData>);
impl Inspect for Wrap {
fn inspect(&self, req: inspect::Request<'_>) {
let mut resp = req.respond();
for task in &self.0 {
resp.child(&task.id().to_string(), |req| {
req.respond()
.field("name", task.name())
.field("executor", task.executor())
.display("state", &task.state())
.field(
"location",
format!("{}:{}", task.location().file(), task.location().line()),
);
});
}
}
}
pub fn inspect_task_list() -> impl Inspect {
Wrap(TaskList::global().tasks())
}