1 /// Waits on multiple concurrent branches, returning when the **first** branch
2 /// completes, cancelling the remaining branches.
3 ///
4 /// The `select!` macro must be used inside of async functions, closures, and
5 /// blocks.
6 ///
7 /// The `select!` macro accepts one or more branches with the following pattern:
8 ///
9 /// ```text
10 /// <pattern> = <async expression> (, if <precondition>)? => <handler>,
11 /// ```
12 ///
13 /// Additionally, the `select!` macro may include a single, optional `else`
14 /// branch, which evaluates if none of the other branches match their patterns:
15 ///
16 /// ```text
17 /// else => <expression>
18 /// ```
19 ///
20 /// The macro aggregates all `<async expression>` expressions and runs them
21 /// concurrently on the **current** task. Once the **first** expression
22 /// completes with a value that matches its `<pattern>`, the `select!` macro
23 /// returns the result of evaluating the completed branch's `<handler>`
24 /// expression.
25 ///
26 /// Additionally, each branch may include an optional `if` precondition. If the
27 /// precondition returns `false`, then the branch is disabled. The provided
28 /// `<async expression>` is still evaluated but the resulting future is never
29 /// polled. This capability is useful when using `select!` within a loop.
30 ///
31 /// The complete lifecycle of a `select!` expression is as follows:
32 ///
33 /// 1. Evaluate all provided `<precondition>` expressions. If the precondition
34 ///    returns `false`, disable the branch for the remainder of the current call
35 ///    to `select!`. Re-entering `select!` due to a loop clears the "disabled"
36 ///    state.
37 /// 2. Aggregate the `<async expression>`s from each branch, including the
38 ///    disabled ones. If the branch is disabled, `<async expression>` is still
39 ///    evaluated, but the resulting future is not polled.
40 /// 3. Concurrently await on the results for all remaining `<async expression>`s.
41 /// 4. Once an `<async expression>` returns a value, attempt to apply the value
42 ///    to the provided `<pattern>`, if the pattern matches, evaluate `<handler>`
43 ///    and return. If the pattern **does not** match, disable the current branch
44 ///    and for the remainder of the current call to `select!`. Continue from step 3.
45 /// 5. If **all** branches are disabled, evaluate the `else` expression. If no
46 ///    else branch is provided, panic.
47 ///
48 /// # Runtime characteristics
49 ///
50 /// By running all async expressions on the current task, the expressions are
51 /// able to run **concurrently** but not in **parallel**. This means all
52 /// expressions are run on the same thread and if one branch blocks the thread,
53 /// all other expressions will be unable to continue. If parallelism is
54 /// required, spawn each async expression using [`tokio::spawn`] and pass the
55 /// join handle to `select!`.
56 ///
57 /// [`tokio::spawn`]: crate::spawn
58 ///
59 /// # Fairness
60 ///
61 /// By default, `select!` randomly picks a branch to check first. This provides
62 /// some level of fairness when calling `select!` in a loop with branches that
63 /// are always ready.
64 ///
65 /// This behavior can be overridden by adding `biased;` to the beginning of the
66 /// macro usage. See the examples for details. This will cause `select` to poll
67 /// the futures in the order they appear from top to bottom. There are a few
68 /// reasons you may want this:
69 ///
70 /// - The random number generation of `tokio::select!` has a non-zero CPU cost
71 /// - Your futures may interact in a way where known polling order is significant
72 ///
73 /// But there is an important caveat to this mode. It becomes your responsibility
74 /// to ensure that the polling order of your futures is fair. If for example you
75 /// are selecting between a stream and a shutdown future, and the stream has a
76 /// huge volume of messages and zero or nearly zero time between them, you should
77 /// place the shutdown future earlier in the `select!` list to ensure that it is
78 /// always polled, and will not be ignored due to the stream being constantly
79 /// ready.
80 ///
81 /// # Panics
82 ///
83 /// The `select!` macro panics if all branches are disabled **and** there is no
84 /// provided `else` branch. A branch is disabled when the provided `if`
85 /// precondition returns `false` **or** when the pattern does not match the
86 /// result of `<async expression>`.
87 ///
88 /// # Cancellation safety
89 ///
90 /// When using `select!` in a loop to receive messages from multiple sources,
91 /// you should make sure that the receive call is cancellation safe to avoid
92 /// losing messages. This section goes through various common methods and
93 /// describes whether they are cancel safe.  The lists in this section are not
94 /// exhaustive.
95 ///
96 /// The following methods are cancellation safe:
97 ///
98 ///  * [`tokio::sync::mpsc::Receiver::recv`](crate::sync::mpsc::Receiver::recv)
99 ///  * [`tokio::sync::mpsc::UnboundedReceiver::recv`](crate::sync::mpsc::UnboundedReceiver::recv)
100 ///  * [`tokio::sync::broadcast::Receiver::recv`](crate::sync::broadcast::Receiver::recv)
101 ///  * [`tokio::sync::watch::Receiver::changed`](crate::sync::watch::Receiver::changed)
102 ///  * [`tokio::net::TcpListener::accept`](crate::net::TcpListener::accept)
103 ///  * [`tokio::net::UnixListener::accept`](crate::net::UnixListener::accept)
104 ///  * [`tokio::io::AsyncReadExt::read`](crate::io::AsyncReadExt::read) on any `AsyncRead`
105 ///  * [`tokio::io::AsyncReadExt::read_buf`](crate::io::AsyncReadExt::read_buf) on any `AsyncRead`
106 ///  * [`tokio::io::AsyncWriteExt::write`](crate::io::AsyncWriteExt::write) on any `AsyncWrite`
107 ///  * [`tokio::io::AsyncWriteExt::write_buf`](crate::io::AsyncWriteExt::write_buf) on any `AsyncWrite`
108 ///  * [`tokio_stream::StreamExt::next`](https://docs.rs/tokio-stream/0.1/tokio_stream/trait.StreamExt.html#method.next) on any `Stream`
109 ///  * [`futures::stream::StreamExt::next`](https://docs.rs/futures/0.3/futures/stream/trait.StreamExt.html#method.next) on any `Stream`
110 ///
111 /// The following methods are not cancellation safe and can lead to loss of data:
112 ///
113 ///  * [`tokio::io::AsyncReadExt::read_exact`](crate::io::AsyncReadExt::read_exact)
114 ///  * [`tokio::io::AsyncReadExt::read_to_end`](crate::io::AsyncReadExt::read_to_end)
115 ///  * [`tokio::io::AsyncReadExt::read_to_string`](crate::io::AsyncReadExt::read_to_string)
116 ///  * [`tokio::io::AsyncWriteExt::write_all`](crate::io::AsyncWriteExt::write_all)
117 ///
118 /// The following methods are not cancellation safe because they use a queue for
119 /// fairness and cancellation makes you lose your place in the queue:
120 ///
121 ///  * [`tokio::sync::Mutex::lock`](crate::sync::Mutex::lock)
122 ///  * [`tokio::sync::RwLock::read`](crate::sync::RwLock::read)
123 ///  * [`tokio::sync::RwLock::write`](crate::sync::RwLock::write)
124 ///  * [`tokio::sync::Semaphore::acquire`](crate::sync::Semaphore::acquire)
125 ///  * [`tokio::sync::Notify::notified`](crate::sync::Notify::notified)
126 ///
127 /// To determine whether your own methods are cancellation safe, look for the
128 /// location of uses of `.await`. This is because when an asynchronous method is
129 /// cancelled, that always happens at an `.await`. If your function behaves
130 /// correctly even if it is restarted while waiting at an `.await`, then it is
131 /// cancellation safe.
132 ///
133 /// Be aware that cancelling something that is not cancellation safe is not
134 /// necessarily wrong. For example, if you are cancelling a task because the
135 /// application is shutting down, then you probably don't care that partially
136 /// read data is lost.
137 ///
138 /// # Examples
139 ///
140 /// Basic select with two branches.
141 ///
142 /// ```
143 /// async fn do_stuff_async() {
144 ///     // async work
145 /// }
146 ///
147 /// async fn more_async_work() {
148 ///     // more here
149 /// }
150 ///
151 /// #[tokio::main]
152 /// async fn main() {
153 ///     tokio::select! {
154 ///         _ = do_stuff_async() => {
155 ///             println!("do_stuff_async() completed first")
156 ///         }
157 ///         _ = more_async_work() => {
158 ///             println!("more_async_work() completed first")
159 ///         }
160 ///     };
161 /// }
162 /// ```
163 ///
164 /// Basic stream selecting.
165 ///
166 /// ```
167 /// use tokio_stream::{self as stream, StreamExt};
168 ///
169 /// #[tokio::main]
170 /// async fn main() {
171 ///     let mut stream1 = stream::iter(vec![1, 2, 3]);
172 ///     let mut stream2 = stream::iter(vec![4, 5, 6]);
173 ///
174 ///     let next = tokio::select! {
175 ///         v = stream1.next() => v.unwrap(),
176 ///         v = stream2.next() => v.unwrap(),
177 ///     };
178 ///
179 ///     assert!(next == 1 || next == 4);
180 /// }
181 /// ```
182 ///
183 /// Collect the contents of two streams. In this example, we rely on pattern
184 /// matching and the fact that `stream::iter` is "fused", i.e. once the stream
185 /// is complete, all calls to `next()` return `None`.
186 ///
187 /// ```
188 /// use tokio_stream::{self as stream, StreamExt};
189 ///
190 /// #[tokio::main]
191 /// async fn main() {
192 ///     let mut stream1 = stream::iter(vec![1, 2, 3]);
193 ///     let mut stream2 = stream::iter(vec![4, 5, 6]);
194 ///
195 ///     let mut values = vec![];
196 ///
197 ///     loop {
198 ///         tokio::select! {
199 ///             Some(v) = stream1.next() => values.push(v),
200 ///             Some(v) = stream2.next() => values.push(v),
201 ///             else => break,
202 ///         }
203 ///     }
204 ///
205 ///     values.sort();
206 ///     assert_eq!(&[1, 2, 3, 4, 5, 6], &values[..]);
207 /// }
208 /// ```
209 ///
210 /// Using the same future in multiple `select!` expressions can be done by passing
211 /// a reference to the future. Doing so requires the future to be [`Unpin`]. A
212 /// future can be made [`Unpin`] by either using [`Box::pin`] or stack pinning.
213 ///
214 /// [`Unpin`]: std::marker::Unpin
215 /// [`Box::pin`]: std::boxed::Box::pin
216 ///
217 /// Here, a stream is consumed for at most 1 second.
218 ///
219 /// ```
220 /// use tokio_stream::{self as stream, StreamExt};
221 /// use tokio::time::{self, Duration};
222 ///
223 /// #[tokio::main]
224 /// async fn main() {
225 ///     let mut stream = stream::iter(vec![1, 2, 3]);
226 ///     let sleep = time::sleep(Duration::from_secs(1));
227 ///     tokio::pin!(sleep);
228 ///
229 ///     loop {
230 ///         tokio::select! {
231 ///             maybe_v = stream.next() => {
232 ///                 if let Some(v) = maybe_v {
233 ///                     println!("got = {}", v);
234 ///                 } else {
235 ///                     break;
236 ///                 }
237 ///             }
238 ///             _ = &mut sleep => {
239 ///                 println!("timeout");
240 ///                 break;
241 ///             }
242 ///         }
243 ///     }
244 /// }
245 /// ```
246 ///
247 /// Joining two values using `select!`.
248 ///
249 /// ```
250 /// use tokio::sync::oneshot;
251 ///
252 /// #[tokio::main]
253 /// async fn main() {
254 ///     let (tx1, mut rx1) = oneshot::channel();
255 ///     let (tx2, mut rx2) = oneshot::channel();
256 ///
257 ///     tokio::spawn(async move {
258 ///         tx1.send("first").unwrap();
259 ///     });
260 ///
261 ///     tokio::spawn(async move {
262 ///         tx2.send("second").unwrap();
263 ///     });
264 ///
265 ///     let mut a = None;
266 ///     let mut b = None;
267 ///
268 ///     while a.is_none() || b.is_none() {
269 ///         tokio::select! {
270 ///             v1 = (&mut rx1), if a.is_none() => a = Some(v1.unwrap()),
271 ///             v2 = (&mut rx2), if b.is_none() => b = Some(v2.unwrap()),
272 ///         }
273 ///     }
274 ///
275 ///     let res = (a.unwrap(), b.unwrap());
276 ///
277 ///     assert_eq!(res.0, "first");
278 ///     assert_eq!(res.1, "second");
279 /// }
280 /// ```
281 ///
282 /// Using the `biased;` mode to control polling order.
283 ///
284 /// ```
285 /// #[tokio::main]
286 /// async fn main() {
287 ///     let mut count = 0u8;
288 ///
289 ///     loop {
290 ///         tokio::select! {
291 ///             // If you run this example without `biased;`, the polling order is
292 ///             // pseudo-random, and the assertions on the value of count will
293 ///             // (probably) fail.
294 ///             biased;
295 ///
296 ///             _ = async {}, if count < 1 => {
297 ///                 count += 1;
298 ///                 assert_eq!(count, 1);
299 ///             }
300 ///             _ = async {}, if count < 2 => {
301 ///                 count += 1;
302 ///                 assert_eq!(count, 2);
303 ///             }
304 ///             _ = async {}, if count < 3 => {
305 ///                 count += 1;
306 ///                 assert_eq!(count, 3);
307 ///             }
308 ///             _ = async {}, if count < 4 => {
309 ///                 count += 1;
310 ///                 assert_eq!(count, 4);
311 ///             }
312 ///
313 ///             else => {
314 ///                 break;
315 ///             }
316 ///         };
317 ///     }
318 /// }
319 /// ```
320 ///
321 /// ## Avoid racy `if` preconditions
322 ///
323 /// Given that `if` preconditions are used to disable `select!` branches, some
324 /// caution must be used to avoid missing values.
325 ///
326 /// For example, here is **incorrect** usage of `sleep` with `if`. The objective
327 /// is to repeatedly run an asynchronous task for up to 50 milliseconds.
328 /// However, there is a potential for the `sleep` completion to be missed.
329 ///
330 /// ```no_run,should_panic
331 /// use tokio::time::{self, Duration};
332 ///
333 /// async fn some_async_work() {
334 ///     // do work
335 /// }
336 ///
337 /// #[tokio::main]
338 /// async fn main() {
339 ///     let sleep = time::sleep(Duration::from_millis(50));
340 ///     tokio::pin!(sleep);
341 ///
342 ///     while !sleep.is_elapsed() {
343 ///         tokio::select! {
344 ///             _ = &mut sleep, if !sleep.is_elapsed() => {
345 ///                 println!("operation timed out");
346 ///             }
347 ///             _ = some_async_work() => {
348 ///                 println!("operation completed");
349 ///             }
350 ///         }
351 ///     }
352 ///
353 ///     panic!("This example shows how not to do it!");
354 /// }
355 /// ```
356 ///
357 /// In the above example, `sleep.is_elapsed()` may return `true` even if
358 /// `sleep.poll()` never returned `Ready`. This opens up a potential race
359 /// condition where `sleep` expires between the `while !sleep.is_elapsed()`
360 /// check and the call to `select!` resulting in the `some_async_work()` call to
361 /// run uninterrupted despite the sleep having elapsed.
362 ///
363 /// One way to write the above example without the race would be:
364 ///
365 /// ```
366 /// use tokio::time::{self, Duration};
367 ///
368 /// async fn some_async_work() {
369 /// # time::sleep(Duration::from_millis(10)).await;
370 ///     // do work
371 /// }
372 ///
373 /// #[tokio::main]
374 /// async fn main() {
375 ///     let sleep = time::sleep(Duration::from_millis(50));
376 ///     tokio::pin!(sleep);
377 ///
378 ///     loop {
379 ///         tokio::select! {
380 ///             _ = &mut sleep => {
381 ///                 println!("operation timed out");
382 ///                 break;
383 ///             }
384 ///             _ = some_async_work() => {
385 ///                 println!("operation completed");
386 ///             }
387 ///         }
388 ///     }
389 /// }
390 /// ```
391 #[macro_export]
392 #[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
393 macro_rules! select {
394     // Uses a declarative macro to do **most** of the work. While it is possible
395     // to implement fully with a declarative macro, a procedural macro is used
396     // to enable improved error messages.
397     //
398     // The macro is structured as a tt-muncher. All branches are processed and
399     // normalized. Once the input is normalized, it is passed to the top-most
400     // rule. When entering the macro, `@{ }` is inserted at the front. This is
401     // used to collect the normalized input.
402     //
403     // The macro only recurses once per branch. This allows using `select!`
404     // without requiring the user to increase the recursion limit.
405 
406     // All input is normalized, now transform.
407     (@ {
408         // The index of the future to poll first (in bias mode), or the RNG
409         // expression to use to pick a future to poll first.
410         start=$start:expr;
411 
412         // One `_` for each branch in the `select!` macro. Passing this to
413         // `count!` converts $skip to an integer.
414         ( $($count:tt)* )
415 
416         // Normalized select branches. `( $skip )` is a set of `_` characters.
417         // There is one `_` for each select branch **before** this one. Given
418         // that all input futures are stored in a tuple, $skip is useful for
419         // generating a pattern to reference the future for the current branch.
420         // $skip is also used as an argument to `count!`, returning the index of
421         // the current select branch.
422         $( ( $($skip:tt)* ) $bind:pat = $fut:expr, if $c:expr => $handle:expr, )+
423 
424         // Fallback expression used when all select branches have been disabled.
425         ; $else:expr
426 
427     }) => {{
428         // Enter a context where stable "function-like" proc macros can be used.
429         //
430         // This module is defined within a scope and should not leak out of this
431         // macro.
432         mod util {
433             // Generate an enum with one variant per select branch
434             $crate::select_priv_declare_output_enum!( ( $($count)* ) );
435         }
436 
437         // `tokio::macros::support` is a public, but doc(hidden) module
438         // including a re-export of all types needed by this macro.
439         use $crate::macros::support::Future;
440         use $crate::macros::support::Pin;
441         use $crate::macros::support::Poll::{Ready, Pending};
442 
443         const BRANCHES: u32 = $crate::count!( $($count)* );
444 
445         let mut disabled: util::Mask = Default::default();
446 
447         // First, invoke all the pre-conditions. For any that return true,
448         // set the appropriate bit in `disabled`.
449         $(
450             if !$c {
451                 let mask: util::Mask = 1 << $crate::count!( $($skip)* );
452                 disabled |= mask;
453             }
454         )*
455 
456         // Create a scope to separate polling from handling the output. This
457         // adds borrow checker flexibility when using the macro.
458         let mut output = {
459             // Safety: Nothing must be moved out of `futures`. This is to
460             // satisfy the requirement of `Pin::new_unchecked` called below.
461             let mut futures = ( $( $fut , )+ );
462 
463             $crate::macros::support::poll_fn(|cx| {
464                 // Track if any branch returns pending. If no branch completes
465                 // **or** returns pending, this implies that all branches are
466                 // disabled.
467                 let mut is_pending = false;
468 
469                 // Choose a starting index to begin polling the futures at. In
470                 // practice, this will either be a pseudo-randomly generated
471                 // number by default, or the constant 0 if `biased;` is
472                 // supplied.
473                 let start = $start;
474 
475                 for i in 0..BRANCHES {
476                     let branch;
477                     #[allow(clippy::modulo_one)]
478                     {
479                         branch = (start + i) % BRANCHES;
480                     }
481                     match branch {
482                         $(
483                             #[allow(unreachable_code)]
484                             $crate::count!( $($skip)* ) => {
485                                 // First, if the future has previously been
486                                 // disabled, do not poll it again. This is done
487                                 // by checking the associated bit in the
488                                 // `disabled` bit field.
489                                 let mask = 1 << branch;
490 
491                                 if disabled & mask == mask {
492                                     // The future has been disabled.
493                                     continue;
494                                 }
495 
496                                 // Extract the future for this branch from the
497                                 // tuple
498                                 let ( $($skip,)* fut, .. ) = &mut futures;
499 
500                                 // Safety: future is stored on the stack above
501                                 // and never moved.
502                                 let mut fut = unsafe { Pin::new_unchecked(fut) };
503 
504                                 // Try polling it
505                                 let out = match Future::poll(fut, cx) {
506                                     Ready(out) => out,
507                                     Pending => {
508                                         // Track that at least one future is
509                                         // still pending and continue polling.
510                                         is_pending = true;
511                                         continue;
512                                     }
513                                 };
514 
515                                 // Disable the future from future polling.
516                                 disabled |= mask;
517 
518                                 // The future returned a value, check if matches
519                                 // the specified pattern.
520                                 #[allow(unused_variables)]
521                                 #[allow(unused_mut)]
522                                 match &out {
523                                     $crate::select_priv_clean_pattern!($bind) => {}
524                                     _ => continue,
525                                 }
526 
527                                 // The select is complete, return the value
528                                 return Ready($crate::select_variant!(util::Out, ($($skip)*))(out));
529                             }
530                         )*
531                         _ => unreachable!("reaching this means there probably is an off by one bug"),
532                     }
533                 }
534 
535                 if is_pending {
536                     Pending
537                 } else {
538                     // All branches have been disabled.
539                     Ready(util::Out::Disabled)
540                 }
541             }).await
542         };
543 
544         match output {
545             $(
546                 $crate::select_variant!(util::Out, ($($skip)*) ($bind)) => $handle,
547             )*
548             util::Out::Disabled => $else,
549             _ => unreachable!("failed to match bind"),
550         }
551     }};
552 
553     // ==== Normalize =====
554 
555     // These rules match a single `select!` branch and normalize it for
556     // processing by the first rule.
557 
558     (@ { start=$start:expr; $($t:tt)* } ) => {
559         // No `else` branch
560         $crate::select!(@{ start=$start; $($t)*; panic!("all branches are disabled and there is no else branch") })
561     };
562     (@ { start=$start:expr; $($t:tt)* } else => $else:expr $(,)?) => {
563         $crate::select!(@{ start=$start; $($t)*; $else })
564     };
565     (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr, if $c:expr => $h:block, $($r:tt)* ) => {
566         $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if $c => $h, } $($r)*)
567     };
568     (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr => $h:block, $($r:tt)* ) => {
569         $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if true => $h, } $($r)*)
570     };
571     (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr, if $c:expr => $h:block $($r:tt)* ) => {
572         $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if $c => $h, } $($r)*)
573     };
574     (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr => $h:block $($r:tt)* ) => {
575         $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if true => $h, } $($r)*)
576     };
577     (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr, if $c:expr => $h:expr ) => {
578         $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if $c => $h, })
579     };
580     (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr => $h:expr ) => {
581         $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if true => $h, })
582     };
583     (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr, if $c:expr => $h:expr, $($r:tt)* ) => {
584         $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if $c => $h, } $($r)*)
585     };
586     (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr => $h:expr, $($r:tt)* ) => {
587         $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if true => $h, } $($r)*)
588     };
589 
590     // ===== Entry point =====
591 
592     (biased; $p:pat = $($t:tt)* ) => {
593         $crate::select!(@{ start=0; () } $p = $($t)*)
594     };
595 
596     ( $p:pat = $($t:tt)* ) => {
597         // Randomly generate a starting point. This makes `select!` a bit more
598         // fair and avoids always polling the first future.
599         $crate::select!(@{ start={ $crate::macros::support::thread_rng_n(BRANCHES) }; () } $p = $($t)*)
600     };
601     () => {
602         compile_error!("select! requires at least one branch.")
603     };
604 }
605 
606 // And here... we manually list out matches for up to 64 branches... I'm not
607 // happy about it either, but this is how we manage to use a declarative macro!
608 
609 #[macro_export]
610 #[doc(hidden)]
611 macro_rules! count {
612     () => {
613         0
614     };
615     (_) => {
616         1
617     };
618     (_ _) => {
619         2
620     };
621     (_ _ _) => {
622         3
623     };
624     (_ _ _ _) => {
625         4
626     };
627     (_ _ _ _ _) => {
628         5
629     };
630     (_ _ _ _ _ _) => {
631         6
632     };
633     (_ _ _ _ _ _ _) => {
634         7
635     };
636     (_ _ _ _ _ _ _ _) => {
637         8
638     };
639     (_ _ _ _ _ _ _ _ _) => {
640         9
641     };
642     (_ _ _ _ _ _ _ _ _ _) => {
643         10
644     };
645     (_ _ _ _ _ _ _ _ _ _ _) => {
646         11
647     };
648     (_ _ _ _ _ _ _ _ _ _ _ _) => {
649         12
650     };
651     (_ _ _ _ _ _ _ _ _ _ _ _ _) => {
652         13
653     };
654     (_ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
655         14
656     };
657     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
658         15
659     };
660     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
661         16
662     };
663     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
664         17
665     };
666     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
667         18
668     };
669     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
670         19
671     };
672     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
673         20
674     };
675     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
676         21
677     };
678     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
679         22
680     };
681     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
682         23
683     };
684     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
685         24
686     };
687     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
688         25
689     };
690     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
691         26
692     };
693     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
694         27
695     };
696     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
697         28
698     };
699     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
700         29
701     };
702     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
703         30
704     };
705     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
706         31
707     };
708     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
709         32
710     };
711     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
712         33
713     };
714     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
715         34
716     };
717     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
718         35
719     };
720     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
721         36
722     };
723     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
724         37
725     };
726     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
727         38
728     };
729     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
730         39
731     };
732     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
733         40
734     };
735     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
736         41
737     };
738     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
739         42
740     };
741     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
742         43
743     };
744     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
745         44
746     };
747     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
748         45
749     };
750     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
751         46
752     };
753     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
754         47
755     };
756     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
757         48
758     };
759     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
760         49
761     };
762     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
763         50
764     };
765     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
766         51
767     };
768     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
769         52
770     };
771     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
772         53
773     };
774     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
775         54
776     };
777     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
778         55
779     };
780     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
781         56
782     };
783     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
784         57
785     };
786     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
787         58
788     };
789     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
790         59
791     };
792     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
793         60
794     };
795     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
796         61
797     };
798     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
799         62
800     };
801     (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
802         63
803     };
804 }
805 
806 #[macro_export]
807 #[doc(hidden)]
808 macro_rules! select_variant {
809     ($($p:ident)::*, () $($t:tt)*) => {
810         $($p)::*::_0 $($t)*
811     };
812     ($($p:ident)::*, (_) $($t:tt)*) => {
813         $($p)::*::_1 $($t)*
814     };
815     ($($p:ident)::*, (_ _) $($t:tt)*) => {
816         $($p)::*::_2 $($t)*
817     };
818     ($($p:ident)::*, (_ _ _) $($t:tt)*) => {
819         $($p)::*::_3 $($t)*
820     };
821     ($($p:ident)::*, (_ _ _ _) $($t:tt)*) => {
822         $($p)::*::_4 $($t)*
823     };
824     ($($p:ident)::*, (_ _ _ _ _) $($t:tt)*) => {
825         $($p)::*::_5 $($t)*
826     };
827     ($($p:ident)::*, (_ _ _ _ _ _) $($t:tt)*) => {
828         $($p)::*::_6 $($t)*
829     };
830     ($($p:ident)::*, (_ _ _ _ _ _ _) $($t:tt)*) => {
831         $($p)::*::_7 $($t)*
832     };
833     ($($p:ident)::*, (_ _ _ _ _ _ _ _) $($t:tt)*) => {
834         $($p)::*::_8 $($t)*
835     };
836     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _) $($t:tt)*) => {
837         $($p)::*::_9 $($t)*
838     };
839     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
840         $($p)::*::_10 $($t)*
841     };
842     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
843         $($p)::*::_11 $($t)*
844     };
845     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
846         $($p)::*::_12 $($t)*
847     };
848     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
849         $($p)::*::_13 $($t)*
850     };
851     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
852         $($p)::*::_14 $($t)*
853     };
854     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
855         $($p)::*::_15 $($t)*
856     };
857     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
858         $($p)::*::_16 $($t)*
859     };
860     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
861         $($p)::*::_17 $($t)*
862     };
863     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
864         $($p)::*::_18 $($t)*
865     };
866     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
867         $($p)::*::_19 $($t)*
868     };
869     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
870         $($p)::*::_20 $($t)*
871     };
872     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
873         $($p)::*::_21 $($t)*
874     };
875     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
876         $($p)::*::_22 $($t)*
877     };
878     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
879         $($p)::*::_23 $($t)*
880     };
881     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
882         $($p)::*::_24 $($t)*
883     };
884     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
885         $($p)::*::_25 $($t)*
886     };
887     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
888         $($p)::*::_26 $($t)*
889     };
890     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
891         $($p)::*::_27 $($t)*
892     };
893     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
894         $($p)::*::_28 $($t)*
895     };
896     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
897         $($p)::*::_29 $($t)*
898     };
899     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
900         $($p)::*::_30 $($t)*
901     };
902     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
903         $($p)::*::_31 $($t)*
904     };
905     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
906         $($p)::*::_32 $($t)*
907     };
908     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
909         $($p)::*::_33 $($t)*
910     };
911     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
912         $($p)::*::_34 $($t)*
913     };
914     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
915         $($p)::*::_35 $($t)*
916     };
917     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
918         $($p)::*::_36 $($t)*
919     };
920     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
921         $($p)::*::_37 $($t)*
922     };
923     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
924         $($p)::*::_38 $($t)*
925     };
926     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
927         $($p)::*::_39 $($t)*
928     };
929     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
930         $($p)::*::_40 $($t)*
931     };
932     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
933         $($p)::*::_41 $($t)*
934     };
935     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
936         $($p)::*::_42 $($t)*
937     };
938     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
939         $($p)::*::_43 $($t)*
940     };
941     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
942         $($p)::*::_44 $($t)*
943     };
944     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
945         $($p)::*::_45 $($t)*
946     };
947     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
948         $($p)::*::_46 $($t)*
949     };
950     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
951         $($p)::*::_47 $($t)*
952     };
953     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
954         $($p)::*::_48 $($t)*
955     };
956     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
957         $($p)::*::_49 $($t)*
958     };
959     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
960         $($p)::*::_50 $($t)*
961     };
962     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
963         $($p)::*::_51 $($t)*
964     };
965     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
966         $($p)::*::_52 $($t)*
967     };
968     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
969         $($p)::*::_53 $($t)*
970     };
971     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
972         $($p)::*::_54 $($t)*
973     };
974     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
975         $($p)::*::_55 $($t)*
976     };
977     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
978         $($p)::*::_56 $($t)*
979     };
980     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
981         $($p)::*::_57 $($t)*
982     };
983     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
984         $($p)::*::_58 $($t)*
985     };
986     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
987         $($p)::*::_59 $($t)*
988     };
989     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
990         $($p)::*::_60 $($t)*
991     };
992     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
993         $($p)::*::_61 $($t)*
994     };
995     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
996         $($p)::*::_62 $($t)*
997     };
998     ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
999         $($p)::*::_63 $($t)*
1000     };
1001 }
1002