pandet
A lightweight library that helps you detect failure of spawned async tasks without having to .await
their handles.
Useful when you are spawning lots of detached tasks but want to fast-fail if a panic occurs.
use *;
let detector = new;
// Whichever async task spawner
spawn;
assert!;
!Send
tasks implement the LocalAlert
trait:
use *;
let detector = new;
spawn_local;
assert!;
Refined control over how to handle panics can also be implemented with PanicMonitor
which works like a stream of alerts. You may also pass some message to the detector/monitor
when a panic occurs:
use StreamExt;
use *;
// Any Unpin + Send + 'static type works
let mut monitor = new; // Or simply PanicMonitor::new()
for task_id in 0..=10
let cnt = 0;
while let Some = monitor.next.await
assert_eq!;