Coverage Report

Created: 2026-04-14 06:46

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.50.0/src/macros/select.rs
Line
Count
Source
1
macro_rules! doc {
2
    ($select:item) => {
3
        /// Waits on multiple concurrent branches, returning when the **first** branch
4
        /// completes, cancelling the remaining branches.
5
        ///
6
        /// The `select!` macro must be used inside of async functions, closures, and
7
        /// blocks.
8
        ///
9
        /// The `select!` macro accepts one or more branches with the following pattern:
10
        ///
11
        /// ```text
12
        /// <pattern> = <async expression> (, if <precondition>)? => <handler>,
13
        /// ```
14
        ///
15
        /// Additionally, the `select!` macro may include a single, optional `else`
16
        /// branch, which evaluates if none of the other branches match their patterns:
17
        ///
18
        /// ```text
19
        /// else => <expression>
20
        /// ```
21
        ///
22
        /// The macro aggregates all `<async expression>` expressions and runs them
23
        /// concurrently on the **current** task. Once the **first** expression
24
        /// completes with a value that matches its `<pattern>`, the `select!` macro
25
        /// returns the result of evaluating the completed branch's `<handler>`
26
        /// expression.
27
        ///
28
        /// Additionally, each branch may include an optional `if` precondition. If the
29
        /// precondition returns `false`, then the branch is disabled. The provided
30
        /// `<async expression>` is still evaluated but the resulting future is never
31
        /// polled. This capability is useful when using `select!` within a loop.
32
        ///
33
        /// The complete lifecycle of a `select!` expression is as follows:
34
        ///
35
        /// 1. Evaluate all provided `<precondition>` expressions. If the precondition
36
        ///    returns `false`, disable the branch for the remainder of the current call
37
        ///    to `select!`. Re-entering `select!` due to a loop clears the "disabled"
38
        ///    state.
39
        /// 2. Aggregate the `<async expression>`s from each branch, including the
40
        ///    disabled ones. If the branch is disabled, `<async expression>` is still
41
        ///    evaluated, but the resulting future is not polled.
42
        /// 3. If **all** branches are disabled: go to step 6.
43
        /// 4. Concurrently await on the results for all remaining `<async expression>`s.
44
        /// 5. Once an `<async expression>` returns a value, attempt to apply the value to the
45
        ///    provided `<pattern>`. If the pattern matches, evaluate the `<handler>` and return.
46
        ///    If the pattern **does not** match, disable the current branch for the remainder of
47
        ///    the current call to `select!`. Continue from step 3.
48
        /// 6. Evaluate the `else` expression. If no else expression is provided, panic.
49
        ///
50
        /// # Runtime characteristics
51
        ///
52
        /// By running all async expressions on the current task, the expressions are
53
        /// able to run **concurrently** but not in **parallel**. This means all
54
        /// expressions are run on the same thread and if one branch blocks the thread,
55
        /// all other expressions will be unable to continue. If parallelism is
56
        /// required, spawn each async expression using [`tokio::spawn`] and pass the
57
        /// join handle to `select!`.
58
        ///
59
        /// [`tokio::spawn`]: crate::spawn
60
        ///
61
        /// # Fairness
62
        ///
63
        /// By default, `select!` randomly picks a branch to check first. This provides
64
        /// some level of fairness when calling `select!` in a loop with branches that
65
        /// are always ready.
66
        ///
67
        /// This behavior can be overridden by adding `biased;` to the beginning of the
68
        /// macro usage. See the examples for details. This will cause `select` to poll
69
        /// the futures in the order they appear from top to bottom. There are a few
70
        /// reasons you may want this:
71
        ///
72
        /// - The random number generation of `tokio::select!` has a non-zero CPU cost
73
        /// - Your futures may interact in a way where known polling order is significant
74
        ///
75
        /// But there is an important caveat to this mode. It becomes your responsibility
76
        /// to ensure that the polling order of your futures is fair. If for example you
77
        /// are selecting between a stream and a shutdown future, and the stream has a
78
        /// huge volume of messages and zero or nearly zero time between them, you should
79
        /// place the shutdown future earlier in the `select!` list to ensure that it is
80
        /// always polled, and will not be ignored due to the stream being constantly
81
        /// ready.
82
        ///
83
        /// # Panics
84
        ///
85
        /// The `select!` macro panics if all branches are disabled **and** there is no
86
        /// provided `else` branch. A branch is disabled when the provided `if`
87
        /// precondition returns `false` **or** when the pattern does not match the
88
        /// result of `<async expression>`.
89
        ///
90
        /// # Cancellation safety
91
        ///
92
        /// When using `select!` in a loop to receive messages from multiple sources,
93
        /// you should make sure that the receive call is cancellation safe to avoid
94
        /// losing messages. This section goes through various common methods and
95
        /// describes whether they are cancel safe.  The lists in this section are not
96
        /// exhaustive.
97
        ///
98
        /// The following methods are cancellation safe:
99
        ///
100
        ///  * [`tokio::sync::mpsc::Receiver::recv`](crate::sync::mpsc::Receiver::recv)
101
        ///  * [`tokio::sync::mpsc::UnboundedReceiver::recv`](crate::sync::mpsc::UnboundedReceiver::recv)
102
        ///  * [`tokio::sync::broadcast::Receiver::recv`](crate::sync::broadcast::Receiver::recv)
103
        ///  * [`tokio::sync::watch::Receiver::changed`](crate::sync::watch::Receiver::changed)
104
        ///  * [`tokio::net::TcpListener::accept`](crate::net::TcpListener::accept)
105
        ///  * [`tokio::net::UnixListener::accept`](crate::net::UnixListener::accept)
106
        ///  * [`tokio::signal::unix::Signal::recv`](crate::signal::unix::Signal::recv)
107
        ///  * [`tokio::io::AsyncReadExt::read`](crate::io::AsyncReadExt::read) on any `AsyncRead`
108
        ///  * [`tokio::io::AsyncReadExt::read_buf`](crate::io::AsyncReadExt::read_buf) on any `AsyncRead`
109
        ///  * [`tokio::io::AsyncWriteExt::write`](crate::io::AsyncWriteExt::write) on any `AsyncWrite`
110
        ///  * [`tokio::io::AsyncWriteExt::write_buf`](crate::io::AsyncWriteExt::write_buf) on any `AsyncWrite`
111
        ///  * [`tokio_stream::StreamExt::next`](https://docs.rs/tokio-stream/0.1/tokio_stream/trait.StreamExt.html#method.next) on any `Stream`
112
        ///  * [`futures::stream::StreamExt::next`](https://docs.rs/futures/0.3/futures/stream/trait.StreamExt.html#method.next) on any `Stream`
113
        ///
114
        /// The following methods are not cancellation safe and can lead to loss of data:
115
        ///
116
        ///  * [`tokio::io::AsyncReadExt::read_exact`](crate::io::AsyncReadExt::read_exact)
117
        ///  * [`tokio::io::AsyncReadExt::read_to_end`](crate::io::AsyncReadExt::read_to_end)
118
        ///  * [`tokio::io::AsyncReadExt::read_to_string`](crate::io::AsyncReadExt::read_to_string)
119
        ///  * [`tokio::io::AsyncWriteExt::write_all`](crate::io::AsyncWriteExt::write_all)
120
        ///
121
        /// The following methods are not cancellation safe because they use a queue for
122
        /// fairness and cancellation makes you lose your place in the queue:
123
        ///
124
        ///  * [`tokio::sync::Mutex::lock`](crate::sync::Mutex::lock)
125
        ///  * [`tokio::sync::RwLock::read`](crate::sync::RwLock::read)
126
        ///  * [`tokio::sync::RwLock::write`](crate::sync::RwLock::write)
127
        ///  * [`tokio::sync::Semaphore::acquire`](crate::sync::Semaphore::acquire)
128
        ///  * [`tokio::sync::Notify::notified`](crate::sync::Notify::notified)
129
        ///
130
        /// To determine whether your own methods are cancellation safe, look for the
131
        /// location of uses of `.await`. This is because when an asynchronous method is
132
        /// cancelled, that always happens at an `.await`. If your function behaves
133
        /// correctly even if it is restarted while waiting at an `.await`, then it is
134
        /// cancellation safe.
135
        ///
136
        /// Cancellation safety can be defined in the following way: If you have a
137
        /// future that has not yet completed, then it must be a no-op to drop that
138
        /// future and recreate it. This definition is motivated by the situation where
139
        /// a `select!` is used in a loop. Without this guarantee, you would lose your
140
        /// progress when another branch completes and you restart the `select!` by
141
        /// going around the loop.
142
        ///
143
        /// Be aware that cancelling something that is not cancellation safe is not
144
        /// necessarily wrong. For example, if you are cancelling a task because the
145
        /// application is shutting down, then you probably don't care that partially
146
        /// read data is lost.
147
        ///
148
        /// # Examples
149
        ///
150
        /// Basic select with two branches.
151
        ///
152
        /// ```
153
        /// async fn do_stuff_async() {
154
        ///     // async work
155
        /// }
156
        ///
157
        /// async fn more_async_work() {
158
        ///     // more here
159
        /// }
160
        ///
161
        /// # #[tokio::main(flavor = "current_thread")]
162
        /// # async fn main() {
163
        /// tokio::select! {
164
        ///     _ = do_stuff_async() => {
165
        ///         println!("do_stuff_async() completed first")
166
        ///     }
167
        ///     _ = more_async_work() => {
168
        ///         println!("more_async_work() completed first")
169
        ///     }
170
        /// };
171
        /// # }
172
        /// ```
173
        ///
174
        /// Basic stream selecting.
175
        ///
176
        /// ```
177
        /// use tokio_stream::{self as stream, StreamExt};
178
        ///
179
        /// # #[tokio::main(flavor = "current_thread")]
180
        /// # async fn main() {
181
        /// let mut stream1 = stream::iter(vec![1, 2, 3]);
182
        /// let mut stream2 = stream::iter(vec![4, 5, 6]);
183
        ///
184
        /// let next = tokio::select! {
185
        ///     v = stream1.next() => v.unwrap(),
186
        ///     v = stream2.next() => v.unwrap(),
187
        /// };
188
        ///
189
        /// assert!(next == 1 || next == 4);
190
        /// # }
191
        /// ```
192
        ///
193
        /// Collect the contents of two streams. In this example, we rely on pattern
194
        /// matching and the fact that `stream::iter` is "fused", i.e. once the stream
195
        /// is complete, all calls to `next()` return `None`.
196
        ///
197
        /// ```
198
        /// use tokio_stream::{self as stream, StreamExt};
199
        ///
200
        /// # #[tokio::main(flavor = "current_thread")]
201
        /// # async fn main() {
202
        /// let mut stream1 = stream::iter(vec![1, 2, 3]);
203
        /// let mut stream2 = stream::iter(vec![4, 5, 6]);
204
        ///
205
        /// let mut values = vec![];
206
        ///
207
        /// loop {
208
        ///     tokio::select! {
209
        ///         Some(v) = stream1.next() => values.push(v),
210
        ///         Some(v) = stream2.next() => values.push(v),
211
        ///         else => break,
212
        ///     }
213
        /// }
214
        ///
215
        /// values.sort();
216
        /// assert_eq!(&[1, 2, 3, 4, 5, 6], &values[..]);
217
        /// # }
218
        /// ```
219
        ///
220
        /// Using the same future in multiple `select!` expressions can be done by passing
221
        /// a reference to the future. Doing so requires the future to be [`Unpin`]. A
222
        /// future can be made [`Unpin`] by either using [`Box::pin`] or stack pinning.
223
        ///
224
        /// [`Unpin`]: std::marker::Unpin
225
        /// [`Box::pin`]: std::boxed::Box::pin
226
        ///
227
        /// Here, a stream is consumed for at most 1 second.
228
        ///
229
        /// ```
230
        /// use tokio_stream::{self as stream, StreamExt};
231
        /// use tokio::time::{self, Duration};
232
        ///
233
        /// # #[tokio::main(flavor = "current_thread")]
234
        /// # async fn main() {
235
        /// let mut stream = stream::iter(vec![1, 2, 3]);
236
        /// let sleep = time::sleep(Duration::from_secs(1));
237
        /// tokio::pin!(sleep);
238
        ///
239
        /// loop {
240
        ///     tokio::select! {
241
        ///         maybe_v = stream.next() => {
242
        ///             if let Some(v) = maybe_v {
243
        ///                 println!("got = {}", v);
244
        ///             } else {
245
        ///                 break;
246
        ///             }
247
        ///         }
248
        ///         _ = &mut sleep => {
249
        ///             println!("timeout");
250
        ///             break;
251
        ///         }
252
        ///     }
253
        /// }
254
        /// # }
255
        /// ```
256
        ///
257
        /// Joining two values using `select!`.
258
        ///
259
        /// ```
260
        /// use tokio::sync::oneshot;
261
        ///
262
        /// # #[tokio::main(flavor = "current_thread")]
263
        /// # async fn main() {
264
        /// let (tx1, mut rx1) = oneshot::channel();
265
        /// let (tx2, mut rx2) = oneshot::channel();
266
        ///
267
        /// tokio::spawn(async move {
268
        ///     tx1.send("first").unwrap();
269
        /// });
270
        ///
271
        /// tokio::spawn(async move {
272
        ///     tx2.send("second").unwrap();
273
        /// });
274
        ///
275
        /// let mut a = None;
276
        /// let mut b = None;
277
        ///
278
        /// while a.is_none() || b.is_none() {
279
        ///     tokio::select! {
280
        ///         v1 = (&mut rx1), if a.is_none() => a = Some(v1.unwrap()),
281
        ///         v2 = (&mut rx2), if b.is_none() => b = Some(v2.unwrap()),
282
        ///     }
283
        /// }
284
        ///
285
        /// let res = (a.unwrap(), b.unwrap());
286
        ///
287
        /// assert_eq!(res.0, "first");
288
        /// assert_eq!(res.1, "second");
289
        /// # }
290
        /// ```
291
        ///
292
        /// Using the `biased;` mode to control polling order.
293
        ///
294
        /// ```
295
        /// # #[tokio::main(flavor = "current_thread")]
296
        /// # async fn main() {
297
        /// let mut count = 0u8;
298
        ///
299
        /// loop {
300
        ///     tokio::select! {
301
        ///         // If you run this example without `biased;`, the polling order is
302
        ///         // pseudo-random, and the assertions on the value of count will
303
        ///         // (probably) fail.
304
        ///         biased;
305
        ///
306
        ///         _ = async {}, if count < 1 => {
307
        ///             count += 1;
308
        ///             assert_eq!(count, 1);
309
        ///         }
310
        ///         _ = async {}, if count < 2 => {
311
        ///             count += 1;
312
        ///             assert_eq!(count, 2);
313
        ///         }
314
        ///         _ = async {}, if count < 3 => {
315
        ///             count += 1;
316
        ///             assert_eq!(count, 3);
317
        ///         }
318
        ///         _ = async {}, if count < 4 => {
319
        ///             count += 1;
320
        ///             assert_eq!(count, 4);
321
        ///         }
322
        ///
323
        ///         else => {
324
        ///             break;
325
        ///         }
326
        ///     };
327
        /// }
328
        /// # }
329
        /// ```
330
        ///
331
        /// ## Avoid racy `if` preconditions
332
        ///
333
        /// Given that `if` preconditions are used to disable `select!` branches, some
334
        /// caution must be used to avoid missing values.
335
        ///
336
        /// For example, here is **incorrect** usage of `sleep` with `if`. The objective
337
        /// is to repeatedly run an asynchronous task for up to 50 milliseconds.
338
        /// However, there is a potential for the `sleep` completion to be missed.
339
        ///
340
        /// ```no_run,should_panic
341
        /// use tokio::time::{self, Duration};
342
        ///
343
        /// async fn some_async_work() {
344
        ///     // do work
345
        /// }
346
        ///
347
        /// # #[tokio::main(flavor = "current_thread")]
348
        /// # async fn main() {
349
        /// let sleep = time::sleep(Duration::from_millis(50));
350
        /// tokio::pin!(sleep);
351
        ///
352
        /// while !sleep.is_elapsed() {
353
        ///     tokio::select! {
354
        ///         _ = &mut sleep, if !sleep.is_elapsed() => {
355
        ///             println!("operation timed out");
356
        ///         }
357
        ///         _ = some_async_work() => {
358
        ///             println!("operation completed");
359
        ///         }
360
        ///     }
361
        /// }
362
        ///
363
        /// panic!("This example shows how not to do it!");
364
        /// # }
365
        /// ```
366
        ///
367
        /// In the above example, `sleep.is_elapsed()` may return `true` even if
368
        /// `sleep.poll()` never returned `Ready`. This opens up a potential race
369
        /// condition where `sleep` expires between the `while !sleep.is_elapsed()`
370
        /// check and the call to `select!` resulting in the `some_async_work()` call to
371
        /// run uninterrupted despite the sleep having elapsed.
372
        ///
373
        /// One way to write the above example without the race would be:
374
        ///
375
        /// ```
376
        /// use tokio::time::{self, Duration};
377
        ///
378
        /// async fn some_async_work() {
379
        /// # time::sleep(Duration::from_millis(10)).await;
380
        ///     // do work
381
        /// }
382
        ///
383
        /// # #[tokio::main(flavor = "current_thread")]
384
        /// # async fn main() {
385
        /// let sleep = time::sleep(Duration::from_millis(50));
386
        /// tokio::pin!(sleep);
387
        ///
388
        /// loop {
389
        ///     tokio::select! {
390
        ///         _ = &mut sleep => {
391
        ///             println!("operation timed out");
392
        ///             break;
393
        ///         }
394
        ///         _ = some_async_work() => {
395
        ///             println!("operation completed");
396
        ///         }
397
        ///     }
398
        /// }
399
        /// # }
400
        /// ```
401
        /// # Alternatives from the Ecosystem
402
        ///
403
        /// The `select!` macro is a powerful tool for managing multiple asynchronous
404
        /// branches, enabling tasks to run concurrently within the same thread. However,
405
        /// its use can introduce challenges, particularly around cancellation safety, which
406
        /// can lead to subtle and hard-to-debug errors. For many use cases, ecosystem
407
        /// alternatives may be preferable as they mitigate these concerns by offering
408
        /// clearer syntax, more predictable control flow, and reducing the need to manually
409
        /// handle issues like fuse semantics or cancellation safety.
410
        ///
411
        /// ## Merging Streams
412
        ///
413
        /// For cases where `loop { select! { ... } }` is used to poll multiple tasks,
414
        /// stream merging offers a concise alternative, inherently handle cancellation-safe
415
        /// processing, removing the risk of data loss. Libraries such as [`tokio_stream`],
416
        /// [`futures::stream`] and [`futures_concurrency`] provide tools for merging
417
        /// streams and handling their outputs sequentially.
418
        ///
419
        /// [`tokio_stream`]: https://docs.rs/tokio-stream/latest/tokio_stream/
420
        /// [`futures::stream`]: https://docs.rs/futures/latest/futures/stream/
421
        /// [`futures_concurrency`]: https://docs.rs/futures-concurrency/latest/futures_concurrency/
422
        ///
423
        /// ### Example with `select!`
424
        ///
425
        /// ```
426
        /// struct File;
427
        /// struct Channel;
428
        /// struct Socket;
429
        ///
430
        /// impl Socket {
431
        ///     async fn read_packet(&mut self) -> Vec<u8> {
432
        ///         vec![]
433
        ///     }
434
        /// }
435
        ///
436
        /// async fn read_send(_file: &mut File, _channel: &mut Channel) {
437
        ///     // do work that is not cancel safe
438
        /// }
439
        ///
440
        /// # #[tokio::main(flavor = "current_thread")]
441
        /// # async fn main() {
442
        /// // open our IO types
443
        /// let mut file = File;
444
        /// let mut channel = Channel;
445
        /// let mut socket = Socket;
446
        ///
447
        /// loop {
448
        ///     tokio::select! {
449
        ///         _ = read_send(&mut file, &mut channel) => { /* ... */ },
450
        ///         _data = socket.read_packet() => { /* ... */ }
451
        ///         _ = futures::future::ready(()) => break
452
        ///     }
453
        /// }
454
        /// # }
455
        /// ```
456
        ///
457
        /// ### Moving to `merge`
458
        ///
459
        /// By using merge, you can unify multiple asynchronous tasks into a single stream,
460
        /// eliminating the need to manage tasks manually and reducing the risk of
461
        /// unintended behavior like data loss.
462
        ///
463
        /// ```
464
        /// use std::pin::pin;
465
        ///
466
        /// use futures::stream::unfold;
467
        /// use tokio_stream::StreamExt;
468
        ///
469
        /// struct File;
470
        /// struct Channel;
471
        /// struct Socket;
472
        ///
473
        /// impl Socket {
474
        ///     async fn read_packet(&mut self) -> Vec<u8> {
475
        ///         vec![]
476
        ///     }
477
        /// }
478
        ///
479
        /// async fn read_send(_file: &mut File, _channel: &mut Channel) {
480
        ///     // do work that is not cancel safe
481
        /// }
482
        ///
483
        /// enum Message {
484
        ///     Stop,
485
        ///     Sent,
486
        ///     Data(Vec<u8>),
487
        /// }
488
        ///
489
        /// # #[tokio::main(flavor = "current_thread")]
490
        /// # async fn main() {
491
        /// // open our IO types
492
        /// let file = File;
493
        /// let channel = Channel;
494
        /// let socket = Socket;
495
        ///
496
        /// let a = unfold((file, channel), |(mut file, mut channel)| async {
497
        ///     read_send(&mut file, &mut channel).await;
498
        ///     Some((Message::Sent, (file, channel)))
499
        /// });
500
        /// let b = unfold(socket, |mut socket| async {
501
        ///     let data = socket.read_packet().await;
502
        ///     Some((Message::Data(data), socket))
503
        /// });
504
        /// let c = tokio_stream::iter([Message::Stop]);
505
        ///
506
        /// let mut s = pin!(a.merge(b).merge(c));
507
        /// while let Some(msg) = s.next().await {
508
        ///     match msg {
509
        ///         Message::Data(_data) => { /* ... */ }
510
        ///         Message::Sent => continue,
511
        ///         Message::Stop => break,
512
        ///     }
513
        /// }
514
        /// # }
515
        /// ```
516
        ///
517
        /// ## Racing Futures
518
        ///
519
        /// If you need to wait for the first completion among several asynchronous tasks,
520
        /// ecosystem utilities such as
521
        /// [`futures`](https://docs.rs/futures/latest/futures/),
522
        /// [`futures-lite`](https://docs.rs/futures-lite/latest/futures_lite/) or
523
        /// [`futures-concurrency`](https://docs.rs/futures-concurrency/latest/futures_concurrency/)
524
        /// provide streamlined syntax for racing futures:
525
        ///
526
        /// - [`futures_concurrency::future::Race`](https://docs.rs/futures-concurrency/latest/futures_concurrency/future/trait.Race.html)
527
        /// - [`futures::select`](https://docs.rs/futures/latest/futures/macro.select.html)
528
        /// - [`futures::stream::select_all`](https://docs.rs/futures/latest/futures/stream/select_all/index.html) (for streams)
529
        /// - [`futures_lite::future::or`](https://docs.rs/futures-lite/latest/futures_lite/future/fn.or.html)
530
        /// - [`futures_lite::future::race`](https://docs.rs/futures-lite/latest/futures_lite/future/fn.race.html)
531
        ///
532
        /// ```
533
        /// use futures_concurrency::future::Race;
534
        ///
535
        /// # #[tokio::main(flavor = "current_thread")]
536
        /// # async fn main() {
537
        /// let task_a = async { Ok("ok") };
538
        /// let task_b = async { Err("error") };
539
        /// let result = (task_a, task_b).race().await;
540
        ///
541
        /// match result {
542
        ///     Ok(output) => println!("First task completed with: {output}"),
543
        ///     Err(err) => eprintln!("Error occurred: {err}"),
544
        /// }
545
        /// # }
546
        /// ```
547
        #[macro_export]
548
        #[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
549
        $select
550
    };
551
}
552
553
#[cfg(doc)]
554
doc! {macro_rules! select {
555
    {
556
        $(
557
            biased;
558
        )?
559
        $(
560
            $bind:pat = $fut:expr $(, if $cond:expr)? => $handler:expr,
561
        )*
562
        $(
563
            else => $els:expr $(,)?
564
        )?
565
    } => {
566
        unimplemented!()
567
    };
568
}}
569
570
#[cfg(not(doc))]
571
doc! {macro_rules! select {
572
    // Uses a declarative macro to do **most** of the work. While it is possible
573
    // to implement fully with a declarative macro, a procedural macro is used
574
    // to enable improved error messages.
575
    //
576
    // The macro is structured as a tt-muncher. All branches are processed and
577
    // normalized. Once the input is normalized, it is passed to the top-most
578
    // rule. When entering the macro, `@{ }` is inserted at the front. This is
579
    // used to collect the normalized input.
580
    //
581
    // The macro only recurses once per branch. This allows using `select!`
582
    // without requiring the user to increase the recursion limit.
583
584
    // All input is normalized, now transform.
585
    (@ {
586
        // The index of the future to poll first (in bias mode), or the RNG
587
        // expression to use to pick a future to poll first.
588
        start=$start:expr;
589
590
        // One `_` for each branch in the `select!` macro. Passing this to
591
        // `count!` converts $skip to an integer.
592
        ( $($count:tt)* )
593
594
        // Normalized select branches. `( $skip )` is a set of `_` characters.
595
        // There is one `_` for each select branch **before** this one. Given
596
        // that all input futures are stored in a tuple, $skip is useful for
597
        // generating a pattern to reference the future for the current branch.
598
        // $skip is also used as an argument to `count!`, returning the index of
599
        // the current select branch.
600
        $( ( $($skip:tt)* ) $bind:pat = $fut:expr, if $c:expr => $handle:expr, )+
601
602
        // Fallback expression used when all select branches have been disabled.
603
        ; $else:expr
604
605
    }) => {{
606
        // Enter a context where stable "function-like" proc macros can be used.
607
        //
608
        // This module is defined within a scope and should not leak out of this
609
        // macro.
610
        #[doc(hidden)]
611
        mod __tokio_select_util {
612
            // Generate an enum with one variant per select branch
613
            $crate::select_priv_declare_output_enum!( ( $($count)* ) );
614
        }
615
616
        // `tokio::macros::support` is a public, but doc(hidden) module
617
        // including a re-export of all types needed by this macro.
618
        use $crate::macros::support::Pin;
619
620
        const BRANCHES: u32 = $crate::count!( $($count)* );
621
622
        let mut disabled: __tokio_select_util::Mask = Default::default();
623
624
        // First, invoke all the pre-conditions. For any that return true,
625
        // set the appropriate bit in `disabled`.
626
        $(
627
            if !$c {
628
                let mask: __tokio_select_util::Mask = 1 << $crate::count!( $($skip)* );
629
                disabled |= mask;
630
            }
631
        )*
632
633
        // Create a scope to separate polling from handling the output. This
634
        // adds borrow checker flexibility when using the macro.
635
        let mut output = {
636
            // Store each future directly first (that is, without wrapping the future in a call to
637
            // `IntoFuture::into_future`). This allows the `$fut` expression to make use of
638
            // temporary lifetime extension.
639
            //
640
            // https://doc.rust-lang.org/1.58.1/reference/destructors.html#temporary-lifetime-extension
641
            let futures_init = ($( $fut, )+);
642
643
            // Safety: Nothing must be moved out of `futures`. This is to
644
            // satisfy the requirement of `Pin::new_unchecked` called below.
645
            //
646
            // We can't use the `pin!` macro for this because `futures` is a
647
            // tuple and the standard library provides no way to pin-project to
648
            // the fields of a tuple.
649
            let mut futures = ($( $crate::macros::support::IntoFuture::into_future(
650
                        $crate::count_field!( futures_init.$($skip)* )
651
            ),)+);
652
653
            // This assignment makes sure that the `poll_fn` closure only has a
654
            // reference to the futures, instead of taking ownership of them.
655
            // This mitigates the issue described in
656
            // <https://internals.rust-lang.org/t/surprising-soundness-trouble-around-pollfn/17484>
657
            let mut futures = &mut futures;
658
659
0
            $crate::macros::support::poll_fn(|cx| {
660
                // Return `Pending` when the task budget is depleted since budget-aware futures
661
                // are going to yield anyway and other futures will not cooperate.
662
0
                ::std::task::ready!($crate::macros::support::poll_budget_available(cx));
663
664
                // Track if any branch returns pending. If no branch completes
665
                // **or** returns pending, this implies that all branches are
666
                // disabled.
667
0
                let mut is_pending = false;
668
669
                // Choose a starting index to begin polling the futures at. In
670
                // practice, this will either be a pseudo-randomly generated
671
                // number by default, or the constant 0 if `biased;` is
672
                // supplied.
673
0
                let start = $start;
674
675
0
                for i in 0..BRANCHES {
676
                    let branch;
677
                    #[allow(clippy::modulo_one)]
678
0
                    {
679
0
                        branch = (start + i) % BRANCHES;
680
0
                    }
681
0
                    match branch {
682
                        $(
683
                            #[allow(unreachable_code)]
684
                            $crate::count!( $($skip)* ) => {
685
                                // First, if the future has previously been
686
                                // disabled, do not poll it again. This is done
687
                                // by checking the associated bit in the
688
                                // `disabled` bit field.
689
0
                                let mask = 1 << branch;
690
691
0
                                if disabled & mask == mask {
692
                                    // The future has been disabled.
693
0
                                    continue;
694
0
                                }
695
696
                                // Extract the future for this branch from the
697
                                // tuple
698
0
                                let ( $($skip,)* fut, .. ) = &mut *futures;
699
700
                                // Safety: future is stored on the stack above
701
                                // and never moved.
702
0
                                let mut fut = unsafe { Pin::new_unchecked(fut) };
703
704
                                // Try polling it
705
0
                                let out = match $crate::macros::support::Future::poll(fut, cx) {
706
0
                                    $crate::macros::support::Poll::Ready(out) => out,
707
                                    $crate::macros::support::Poll::Pending => {
708
                                        // Track that at least one future is
709
                                        // still pending and continue polling.
710
0
                                        is_pending = true;
711
0
                                        continue;
712
                                    }
713
                                };
714
715
                                // Disable the future from future polling.
716
0
                                disabled |= mask;
717
718
                                // The future returned a value, check if matches
719
                                // the specified pattern.
720
                                #[allow(unused_variables)]
721
                                #[allow(unused_mut)]
722
0
                                match &out {
723
0
                                    $crate::select_priv_clean_pattern!($bind) => {}
724
0
                                    _ => continue,
725
                                }
726
727
                                // The select is complete, return the value
728
0
                                return $crate::macros::support::Poll::Ready($crate::select_variant!(__tokio_select_util::Out, ($($skip)*))(out));
729
                            }
730
                        )*
731
0
                        _ => unreachable!("reaching this means there probably is an off by one bug"),
732
                    }
733
                }
734
735
0
                if is_pending {
736
0
                    $crate::macros::support::Poll::Pending
737
                } else {
738
                    // All branches have been disabled.
739
0
                    $crate::macros::support::Poll::Ready(__tokio_select_util::Out::Disabled)
740
                }
741
0
            }).await
Unexecuted instantiation: <ztunnel::xds::client::AdsClient>::run_internal::{closure#0}::{closure#6}
Unexecuted instantiation: <ztunnel::dns::server::Server>::run::{closure#0}::{closure#0}
Unexecuted instantiation: ztunnel::proxy::h2::server::serve_connection::<<ztunnel::proxy::inbound::Inbound>::run::{closure#0}::{closure#0}::{closure#0}::{closure#0}::{closure#0}, tracing::instrument::Instrumented<<ztunnel::proxy::inbound::Inbound>::serve_connect::{closure#0}>>::{closure#0}::{closure#2}
Unexecuted instantiation: ztunnel::proxy::h2::server::serve_connection::<<ztunnel::proxy::inbound::Inbound>::run::{closure#0}::{closure#0}::{closure#0}::{closure#0}::{closure#0}, tracing::instrument::Instrumented<<ztunnel::proxy::inbound::Inbound>::serve_connect::{closure#0}>>::{closure#0}::{closure#5}
Unexecuted instantiation: <ztunnel::proxy::connection_manager::PolicyWatcher>::run::{closure#0}::{closure#0}
Unexecuted instantiation: <ztunnel::identity::manager::Worker>::run::{closure#0}::{closure#1}
Unexecuted instantiation: <ztunnel::identity::manager::SecretManager>::wait::{closure#0}::{closure#0}
Unexecuted instantiation: <ztunnel::proxy::outbound::Outbound>::run::{closure#0}::{closure#0}::{closure#0}::{closure#0}::{closure#1}
Unexecuted instantiation: <ztunnel::proxy::socks5::Socks5>::run::{closure#0}::{closure#0}::{closure#0}::{closure#0}::{closure#1}
Unexecuted instantiation: <ztunnel::state::DemandProxyState>::wait_for_workload::{closure#0}::{closure#2}
Unexecuted instantiation: <ztunnel::inpod::protocol::WorkloadStreamProcessor>::read_message::{closure#0}::{closure#1}
Unexecuted instantiation: <ztunnel::inpod::workloadmanager::WorkloadProxyManager>::run_internal::{closure#0}::{closure#1}
Unexecuted instantiation: <pingora_pool::connection::ConnectionPool<ztunnel::proxy::h2::client::H2ConnectClient>>::idle_timeout::{closure#0}::{closure#0}
Unexecuted instantiation: <ztunnel::proxy::inbound::Inbound>::serve_connect::{closure#0}::{closure#5}
Unexecuted instantiation: ztunnel::proxy::h2::client::drive_connection::<tokio_rustls::client::TlsStream<ztunnel::proxy::h2::TokioH2Stream>, bytes::bytes::Bytes>::{closure#0}::{closure#0}
Unexecuted instantiation: ztunnel::proxy::h2::client::drive_connection::<tokio_rustls::client::TlsStream<tokio::net::tcp::stream::TcpStream>, bytes::bytes::Bytes>::{closure#0}::{closure#0}
Unexecuted instantiation: <ztunnel::proxy::inbound_passthrough::InboundPassthrough>::run::{closure#0}::{closure#0}::{closure#0}::{closure#0}::{closure#1}
Unexecuted instantiation: <ztunnel::proxy::inbound_passthrough::InboundPassthrough>::proxy_inbound_plaintext::{closure#0}::{closure#1}
Unexecuted instantiation: <hickory_server::server::ServerFuture<ztunnel::dns::handler::Handler>>::register_socket::{closure#0}::{closure#1}
Unexecuted instantiation: <hickory_server::server::ServerFuture<ztunnel::dns::handler::Handler>>::register_listener::{closure#0}::{closure#1}
Unexecuted instantiation: ztunnel::signal::imp::shutdown::{closure#0}::{closure#0}
Unexecuted instantiation: ztunnel::drain::run_with_drain::<<ztunnel::proxy::inbound_passthrough::InboundPassthrough>::run::{closure#0}::{closure#0}, ()>::{closure#0}::{closure#0}
Unexecuted instantiation: ztunnel::drain::run_with_drain::<<ztunnel::proxy::socks5::Socks5>::run::{closure#0}::{closure#0}, ()>::{closure#0}::{closure#0}
Unexecuted instantiation: ztunnel::drain::run_with_drain::<<ztunnel::proxy::inbound::Inbound>::run::{closure#0}::{closure#0}, ()>::{closure#0}::{closure#0}
Unexecuted instantiation: ztunnel::drain::run_with_drain::<<ztunnel::proxy::outbound::Outbound>::run::{closure#0}::{closure#0}, ()>::{closure#0}::{closure#0}
Unexecuted instantiation: <pingora_pool::connection::ConnectionPool<_>>::idle_poll::<_>::{closure#0}::{closure#0}
Unexecuted instantiation: <pingora_pool::connection::ConnectionPool<_>>::idle_timeout::{closure#0}::{closure#0}
Unexecuted instantiation: <hickory_server::server::ServerFuture<_>>::register_socket::{closure#0}::{closure#1}
Unexecuted instantiation: <hickory_server::server::ServerFuture<_>>::register_listener::{closure#0}::{closure#1}
742
        };
743
744
        match output {
745
            $(
746
                $crate::select_variant!(__tokio_select_util::Out, ($($skip)*) ($bind)) => $handle,
747
            )*
748
            __tokio_select_util::Out::Disabled => $else,
749
            _ => unreachable!("failed to match bind"),
750
        }
751
    }};
752
753
    // ==== Normalize =====
754
755
    // These rules match a single `select!` branch and normalize it for
756
    // processing by the first rule.
757
758
    (@ { start=$start:expr; $($t:tt)* } ) => {
759
        // No `else` branch
760
        $crate::select!(@{ start=$start; $($t)*; panic!("all branches are disabled and there is no else branch") })
761
    };
762
    (@ { start=$start:expr; $($t:tt)* } else => $else:expr $(,)?) => {
763
        $crate::select!(@{ start=$start; $($t)*; $else })
764
    };
765
    (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr, if $c:expr => $h:block, $($r:tt)* ) => {
766
        $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if $c => $h, } $($r)*)
767
    };
768
    (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr => $h:block, $($r:tt)* ) => {
769
        $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if true => $h, } $($r)*)
770
    };
771
    (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr, if $c:expr => $h:block $($r:tt)* ) => {
772
        $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if $c => $h, } $($r)*)
773
    };
774
    (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr => $h:block $($r:tt)* ) => {
775
        $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if true => $h, } $($r)*)
776
    };
777
    (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr, if $c:expr => $h:expr ) => {
778
        $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if $c => $h, })
779
    };
780
    (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr => $h:expr ) => {
781
        $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if true => $h, })
782
    };
783
    (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr, if $c:expr => $h:expr, $($r:tt)* ) => {
784
        $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if $c => $h, } $($r)*)
785
    };
786
    (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr => $h:expr, $($r:tt)* ) => {
787
        $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if true => $h, } $($r)*)
788
    };
789
790
    // ===== Entry point =====
791
792
    ($(biased;)? else => $else:expr $(,)? ) => {{
793
        $else
794
    }};
795
796
    (biased; $p:pat = $($t:tt)* ) => {
797
        $crate::select!(@{ start=0; () } $p = $($t)*)
798
    };
799
800
    ( $p:pat = $($t:tt)* ) => {
801
        // Randomly generate a starting point. This makes `select!` a bit more
802
        // fair and avoids always polling the first future.
803
        $crate::select!(@{ start={ $crate::macros::support::thread_rng_n(BRANCHES) }; () } $p = $($t)*)
804
    };
805
806
    () => {
807
        compile_error!("select! requires at least one branch.")
808
    };
809
}}
810
811
// And here... we manually list out matches for up to 64 branches... I'm not
812
// happy about it either, but this is how we manage to use a declarative macro!
813
814
#[macro_export]
815
#[doc(hidden)]
816
macro_rules! count {
817
    () => {
818
        0
819
    };
820
    (_) => {
821
        1
822
    };
823
    (_ _) => {
824
        2
825
    };
826
    (_ _ _) => {
827
        3
828
    };
829
    (_ _ _ _) => {
830
        4
831
    };
832
    (_ _ _ _ _) => {
833
        5
834
    };
835
    (_ _ _ _ _ _) => {
836
        6
837
    };
838
    (_ _ _ _ _ _ _) => {
839
        7
840
    };
841
    (_ _ _ _ _ _ _ _) => {
842
        8
843
    };
844
    (_ _ _ _ _ _ _ _ _) => {
845
        9
846
    };
847
    (_ _ _ _ _ _ _ _ _ _) => {
848
        10
849
    };
850
    (_ _ _ _ _ _ _ _ _ _ _) => {
851
        11
852
    };
853
    (_ _ _ _ _ _ _ _ _ _ _ _) => {
854
        12
855
    };
856
    (_ _ _ _ _ _ _ _ _ _ _ _ _) => {
857
        13
858
    };
859
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
860
        14
861
    };
862
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
863
        15
864
    };
865
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
866
        16
867
    };
868
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
869
        17
870
    };
871
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
872
        18
873
    };
874
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
875
        19
876
    };
877
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
878
        20
879
    };
880
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
881
        21
882
    };
883
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
884
        22
885
    };
886
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
887
        23
888
    };
889
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
890
        24
891
    };
892
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
893
        25
894
    };
895
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
896
        26
897
    };
898
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
899
        27
900
    };
901
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
902
        28
903
    };
904
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
905
        29
906
    };
907
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
908
        30
909
    };
910
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
911
        31
912
    };
913
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
914
        32
915
    };
916
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
917
        33
918
    };
919
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
920
        34
921
    };
922
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
923
        35
924
    };
925
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
926
        36
927
    };
928
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
929
        37
930
    };
931
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
932
        38
933
    };
934
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
935
        39
936
    };
937
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
938
        40
939
    };
940
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
941
        41
942
    };
943
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
944
        42
945
    };
946
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
947
        43
948
    };
949
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
950
        44
951
    };
952
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
953
        45
954
    };
955
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
956
        46
957
    };
958
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
959
        47
960
    };
961
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
962
        48
963
    };
964
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
965
        49
966
    };
967
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
968
        50
969
    };
970
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
971
        51
972
    };
973
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
974
        52
975
    };
976
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
977
        53
978
    };
979
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
980
        54
981
    };
982
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
983
        55
984
    };
985
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
986
        56
987
    };
988
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
989
        57
990
    };
991
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
992
        58
993
    };
994
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
995
        59
996
    };
997
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
998
        60
999
    };
1000
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1001
        61
1002
    };
1003
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1004
        62
1005
    };
1006
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1007
        63
1008
    };
1009
    (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1010
        64
1011
    };
1012
}
1013
1014
#[macro_export]
1015
#[doc(hidden)]
1016
macro_rules! count_field {
1017
    ($var:ident. ) => {
1018
        $var.0
1019
    };
1020
    ($var:ident. _) => {
1021
        $var.1
1022
    };
1023
    ($var:ident. _ _) => {
1024
        $var.2
1025
    };
1026
    ($var:ident. _ _ _) => {
1027
        $var.3
1028
    };
1029
    ($var:ident. _ _ _ _) => {
1030
        $var.4
1031
    };
1032
    ($var:ident. _ _ _ _ _) => {
1033
        $var.5
1034
    };
1035
    ($var:ident. _ _ _ _ _ _) => {
1036
        $var.6
1037
    };
1038
    ($var:ident. _ _ _ _ _ _ _) => {
1039
        $var.7
1040
    };
1041
    ($var:ident. _ _ _ _ _ _ _ _) => {
1042
        $var.8
1043
    };
1044
    ($var:ident. _ _ _ _ _ _ _ _ _) => {
1045
        $var.9
1046
    };
1047
    ($var:ident. _ _ _ _ _ _ _ _ _ _) => {
1048
        $var.10
1049
    };
1050
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _) => {
1051
        $var.11
1052
    };
1053
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _) => {
1054
        $var.12
1055
    };
1056
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1057
        $var.13
1058
    };
1059
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1060
        $var.14
1061
    };
1062
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1063
        $var.15
1064
    };
1065
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1066
        $var.16
1067
    };
1068
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1069
        $var.17
1070
    };
1071
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1072
        $var.18
1073
    };
1074
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1075
        $var.19
1076
    };
1077
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1078
        $var.20
1079
    };
1080
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1081
        $var.21
1082
    };
1083
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1084
        $var.22
1085
    };
1086
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1087
        $var.23
1088
    };
1089
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1090
        $var.24
1091
    };
1092
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1093
        $var.25
1094
    };
1095
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1096
        $var.26
1097
    };
1098
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1099
        $var.27
1100
    };
1101
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1102
        $var.28
1103
    };
1104
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1105
        $var.29
1106
    };
1107
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1108
        $var.30
1109
    };
1110
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1111
        $var.31
1112
    };
1113
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1114
        $var.32
1115
    };
1116
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1117
        $var.33
1118
    };
1119
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1120
        $var.34
1121
    };
1122
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1123
        $var.35
1124
    };
1125
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1126
        $var.36
1127
    };
1128
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1129
        $var.37
1130
    };
1131
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1132
        $var.38
1133
    };
1134
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1135
        $var.39
1136
    };
1137
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1138
        $var.40
1139
    };
1140
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1141
        $var.41
1142
    };
1143
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1144
        $var.42
1145
    };
1146
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1147
        $var.43
1148
    };
1149
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1150
        $var.44
1151
    };
1152
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1153
        $var.45
1154
    };
1155
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1156
        $var.46
1157
    };
1158
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1159
        $var.47
1160
    };
1161
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1162
        $var.48
1163
    };
1164
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1165
        $var.49
1166
    };
1167
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1168
        $var.50
1169
    };
1170
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1171
        $var.51
1172
    };
1173
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1174
        $var.52
1175
    };
1176
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1177
        $var.53
1178
    };
1179
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1180
        $var.54
1181
    };
1182
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1183
        $var.55
1184
    };
1185
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1186
        $var.56
1187
    };
1188
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1189
        $var.57
1190
    };
1191
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1192
        $var.58
1193
    };
1194
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1195
        $var.59
1196
    };
1197
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1198
        $var.60
1199
    };
1200
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1201
        $var.61
1202
    };
1203
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1204
        $var.62
1205
    };
1206
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1207
        $var.63
1208
    };
1209
    ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1210
        $var.64
1211
    };
1212
}
1213
1214
#[macro_export]
1215
#[doc(hidden)]
1216
macro_rules! select_variant {
1217
    ($($p:ident)::*, () $($t:tt)*) => {
1218
        $($p)::*::_0 $($t)*
1219
    };
1220
    ($($p:ident)::*, (_) $($t:tt)*) => {
1221
        $($p)::*::_1 $($t)*
1222
    };
1223
    ($($p:ident)::*, (_ _) $($t:tt)*) => {
1224
        $($p)::*::_2 $($t)*
1225
    };
1226
    ($($p:ident)::*, (_ _ _) $($t:tt)*) => {
1227
        $($p)::*::_3 $($t)*
1228
    };
1229
    ($($p:ident)::*, (_ _ _ _) $($t:tt)*) => {
1230
        $($p)::*::_4 $($t)*
1231
    };
1232
    ($($p:ident)::*, (_ _ _ _ _) $($t:tt)*) => {
1233
        $($p)::*::_5 $($t)*
1234
    };
1235
    ($($p:ident)::*, (_ _ _ _ _ _) $($t:tt)*) => {
1236
        $($p)::*::_6 $($t)*
1237
    };
1238
    ($($p:ident)::*, (_ _ _ _ _ _ _) $($t:tt)*) => {
1239
        $($p)::*::_7 $($t)*
1240
    };
1241
    ($($p:ident)::*, (_ _ _ _ _ _ _ _) $($t:tt)*) => {
1242
        $($p)::*::_8 $($t)*
1243
    };
1244
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1245
        $($p)::*::_9 $($t)*
1246
    };
1247
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1248
        $($p)::*::_10 $($t)*
1249
    };
1250
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1251
        $($p)::*::_11 $($t)*
1252
    };
1253
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1254
        $($p)::*::_12 $($t)*
1255
    };
1256
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1257
        $($p)::*::_13 $($t)*
1258
    };
1259
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1260
        $($p)::*::_14 $($t)*
1261
    };
1262
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1263
        $($p)::*::_15 $($t)*
1264
    };
1265
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1266
        $($p)::*::_16 $($t)*
1267
    };
1268
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1269
        $($p)::*::_17 $($t)*
1270
    };
1271
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1272
        $($p)::*::_18 $($t)*
1273
    };
1274
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1275
        $($p)::*::_19 $($t)*
1276
    };
1277
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1278
        $($p)::*::_20 $($t)*
1279
    };
1280
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1281
        $($p)::*::_21 $($t)*
1282
    };
1283
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1284
        $($p)::*::_22 $($t)*
1285
    };
1286
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1287
        $($p)::*::_23 $($t)*
1288
    };
1289
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1290
        $($p)::*::_24 $($t)*
1291
    };
1292
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1293
        $($p)::*::_25 $($t)*
1294
    };
1295
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1296
        $($p)::*::_26 $($t)*
1297
    };
1298
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1299
        $($p)::*::_27 $($t)*
1300
    };
1301
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1302
        $($p)::*::_28 $($t)*
1303
    };
1304
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1305
        $($p)::*::_29 $($t)*
1306
    };
1307
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1308
        $($p)::*::_30 $($t)*
1309
    };
1310
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1311
        $($p)::*::_31 $($t)*
1312
    };
1313
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1314
        $($p)::*::_32 $($t)*
1315
    };
1316
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1317
        $($p)::*::_33 $($t)*
1318
    };
1319
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1320
        $($p)::*::_34 $($t)*
1321
    };
1322
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1323
        $($p)::*::_35 $($t)*
1324
    };
1325
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1326
        $($p)::*::_36 $($t)*
1327
    };
1328
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1329
        $($p)::*::_37 $($t)*
1330
    };
1331
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1332
        $($p)::*::_38 $($t)*
1333
    };
1334
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1335
        $($p)::*::_39 $($t)*
1336
    };
1337
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1338
        $($p)::*::_40 $($t)*
1339
    };
1340
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1341
        $($p)::*::_41 $($t)*
1342
    };
1343
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1344
        $($p)::*::_42 $($t)*
1345
    };
1346
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1347
        $($p)::*::_43 $($t)*
1348
    };
1349
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1350
        $($p)::*::_44 $($t)*
1351
    };
1352
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1353
        $($p)::*::_45 $($t)*
1354
    };
1355
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1356
        $($p)::*::_46 $($t)*
1357
    };
1358
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1359
        $($p)::*::_47 $($t)*
1360
    };
1361
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1362
        $($p)::*::_48 $($t)*
1363
    };
1364
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1365
        $($p)::*::_49 $($t)*
1366
    };
1367
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1368
        $($p)::*::_50 $($t)*
1369
    };
1370
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1371
        $($p)::*::_51 $($t)*
1372
    };
1373
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1374
        $($p)::*::_52 $($t)*
1375
    };
1376
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1377
        $($p)::*::_53 $($t)*
1378
    };
1379
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1380
        $($p)::*::_54 $($t)*
1381
    };
1382
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1383
        $($p)::*::_55 $($t)*
1384
    };
1385
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1386
        $($p)::*::_56 $($t)*
1387
    };
1388
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1389
        $($p)::*::_57 $($t)*
1390
    };
1391
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1392
        $($p)::*::_58 $($t)*
1393
    };
1394
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1395
        $($p)::*::_59 $($t)*
1396
    };
1397
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1398
        $($p)::*::_60 $($t)*
1399
    };
1400
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1401
        $($p)::*::_61 $($t)*
1402
    };
1403
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1404
        $($p)::*::_62 $($t)*
1405
    };
1406
    ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1407
        $($p)::*::_63 $($t)*
1408
    };
1409
}