scoped-join-set 0.8.2

A scoped variant of tokio::task::JoinSet for spawning non-'static futures.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use scoped_join_set::{scope, JoinError};

#[tokio::test]
async fn panicking_task() {
    scope::<(), _, _>(async |s| {
        s.spawn(async {
            panic!("test panic");
        });

        let res = s.join_next().await;
        assert!(
            matches!(res, Some(Err(JoinError::Panicked(_)))),
            "Panicking task should return JoinError::Panicked"
        );
    })
    .await;
}