macro join_internal {
(
// Accumulate a token for each future that has been expanded: "_ _ _".
current_position: [
$($underscores:tt)*
]
// Accumulate Futures and their positions in the tuple: `_0th () _1st ( _ ) …`.
futures_and_positions: [
$($acc:tt)*
]
// Munch one future.
munching: [
$current:tt
$($rest:tt)*
]
) => { ... },
(
current_position: $_:tt
futures_and_positions: [
$(
$fut_expr:tt ( $($pos:tt)* )
)*
]
// Nothing left to munch.
munching: []
) => { ... },
}
🔬This is a nightly-only experimental API. (
future_join
#91642)Expand description
To be able to name the i-th future in the tuple (say we want the .4-th),
the following trick will be used: let (_, _, _, _, it, ..) = tuple;
In order to do that, we need to generate a i
-long repetition of _
,
for each i-th fut. Hence the recursive muncher approach.