pub async fn caught<T>(
operation: &'static str,
work: impl Future<Output = T>,
) -> Result<T, Bug>Expand description
Run work inline, catching a panic in any of its polls. For one message of
a long-lived loop: the panic fails that message and the loop serves the
next. The runtime can’t drop work that runs inline, so a panic is its
only failure.
After a panic, caught drops work at once, inside a catch of its own, so
a drop that panics on what the first panic left behind does not unwind
into the caller either.