mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-10-01 12:20:39 +00:00
parent
c89406965f
commit
ca9f7ee9f4
@ -158,7 +158,9 @@ macro_rules! join {
|
|||||||
|
|
||||||
// ===== Entry point =====
|
// ===== Entry point =====
|
||||||
|
|
||||||
( $($e:expr),* $(,)?) => {
|
( $($e:expr),+ $(,)?) => {
|
||||||
$crate::join!(@{ () (0) } $($e,)*)
|
$crate::join!(@{ () (0) } $($e,)*)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
() => { async {}.await }
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,9 @@ macro_rules! try_join {
|
|||||||
|
|
||||||
// ===== Entry point =====
|
// ===== Entry point =====
|
||||||
|
|
||||||
( $($e:expr),* $(,)?) => {
|
( $($e:expr),+ $(,)?) => {
|
||||||
$crate::try_join!(@{ () (0) } $($e,)*)
|
$crate::try_join!(@{ () (0) } $($e,)*)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
() => { async { Ok(()) }.await }
|
||||||
}
|
}
|
||||||
|
@ -153,3 +153,9 @@ async fn a_different_future_is_polled_first_every_time_poll_fn_is_polled() {
|
|||||||
*poll_order.lock().unwrap()
|
*poll_order.lock().unwrap()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
#[allow(clippy::unit_cmp)]
|
||||||
|
async fn empty_join() {
|
||||||
|
assert_eq!(tokio::join!(), ());
|
||||||
|
}
|
||||||
|
@ -183,3 +183,8 @@ async fn a_different_future_is_polled_first_every_time_poll_fn_is_polled() {
|
|||||||
*poll_order.lock().unwrap()
|
*poll_order.lock().unwrap()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn empty_try_join() {
|
||||||
|
assert_eq!(tokio::try_join!() as Result<_, ()>, Ok(()));
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user