tokio/macros/select.rs
1macro_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]
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]
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]
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]
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]
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]
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]
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]
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]
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 ///
458 /// ### Moving to `merge`
459 ///
460 /// By using merge, you can unify multiple asynchronous tasks into a single stream,
461 /// eliminating the need to manage tasks manually and reducing the risk of
462 /// unintended behavior like data loss.
463 ///
464 /// ```
465 /// use std::pin::pin;
466 ///
467 /// use futures::stream::unfold;
468 /// use tokio_stream::StreamExt;
469 ///
470 /// struct File;
471 /// struct Channel;
472 /// struct Socket;
473 ///
474 /// impl Socket {
475 /// async fn read_packet(&mut self) -> Vec<u8> {
476 /// vec![]
477 /// }
478 /// }
479 ///
480 /// async fn read_send(_file: &mut File, _channel: &mut Channel) {
481 /// // do work that is not cancel safe
482 /// }
483 ///
484 /// enum Message {
485 /// Stop,
486 /// Sent,
487 /// Data(Vec<u8>),
488 /// }
489 ///
490 /// #[tokio::main]
491 /// async fn main() {
492 /// // open our IO types
493 /// let file = File;
494 /// let channel = Channel;
495 /// let socket = Socket;
496 ///
497 /// let a = unfold((file, channel), |(mut file, mut channel)| async {
498 /// read_send(&mut file, &mut channel).await;
499 /// Some((Message::Sent, (file, channel)))
500 /// });
501 /// let b = unfold(socket, |mut socket| async {
502 /// let data = socket.read_packet().await;
503 /// Some((Message::Data(data), socket))
504 /// });
505 /// let c = tokio_stream::iter([Message::Stop]);
506 ///
507 /// let mut s = pin!(a.merge(b).merge(c));
508 /// while let Some(msg) = s.next().await {
509 /// match msg {
510 /// Message::Data(_data) => { /* ... */ }
511 /// Message::Sent => continue,
512 /// Message::Stop => break,
513 /// }
514 /// }
515 /// }
516 /// ```
517 ///
518 /// ## Racing Futures
519 ///
520 /// If you need to wait for the first completion among several asynchronous tasks,
521 /// ecosystem utilities such as
522 /// [`futures`](https://docs.rs/futures/latest/futures/),
523 /// [`futures-lite`](https://docs.rs/futures-lite/latest/futures_lite/) or
524 /// [`futures-concurrency`](https://docs.rs/futures-concurrency/latest/futures_concurrency/)
525 /// provide streamlined syntax for racing futures:
526 ///
527 /// - [`futures_concurrency::future::Race`](https://docs.rs/futures-concurrency/latest/futures_concurrency/future/trait.Race.html)
528 /// - [`futures::select`](https://docs.rs/futures/latest/futures/macro.select.html)
529 /// - [`futures::stream::select_all`](https://docs.rs/futures/latest/futures/stream/select_all/index.html) (for streams)
530 /// - [`futures_lite::future::or`](https://docs.rs/futures-lite/latest/futures_lite/future/fn.or.html)
531 /// - [`futures_lite::future::race`](https://docs.rs/futures-lite/latest/futures_lite/future/fn.race.html)
532 ///
533 /// ```
534 /// use futures_concurrency::future::Race;
535 ///
536 /// #[tokio::main]
537 /// async fn main() {
538 /// let task_a = async { Ok("ok") };
539 /// let task_b = async { Err("error") };
540 /// let result = (task_a, task_b).race().await;
541 ///
542 /// match result {
543 /// Ok(output) => println!("First task completed with: {output}"),
544 /// Err(err) => eprintln!("Error occurred: {err}"),
545 /// }
546 /// }
547 /// ```
548 #[macro_export]
549 #[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
550 $select
551 };
552}
553
554#[cfg(doc)]
555doc! {macro_rules! select {
556 {
557 $(
558 biased;
559 )?
560 $(
561 $bind:pat = $fut:expr $(, if $cond:expr)? => $handler:expr,
562 )*
563 $(
564 else => $els:expr $(,)?
565 )?
566 } => {
567 unimplemented!()
568 };
569}}
570
571#[cfg(not(doc))]
572doc! {macro_rules! select {
573 // Uses a declarative macro to do **most** of the work. While it is possible
574 // to implement fully with a declarative macro, a procedural macro is used
575 // to enable improved error messages.
576 //
577 // The macro is structured as a tt-muncher. All branches are processed and
578 // normalized. Once the input is normalized, it is passed to the top-most
579 // rule. When entering the macro, `@{ }` is inserted at the front. This is
580 // used to collect the normalized input.
581 //
582 // The macro only recurses once per branch. This allows using `select!`
583 // without requiring the user to increase the recursion limit.
584
585 // All input is normalized, now transform.
586 (@ {
587 // The index of the future to poll first (in bias mode), or the RNG
588 // expression to use to pick a future to poll first.
589 start=$start:expr;
590
591 // One `_` for each branch in the `select!` macro. Passing this to
592 // `count!` converts $skip to an integer.
593 ( $($count:tt)* )
594
595 // Normalized select branches. `( $skip )` is a set of `_` characters.
596 // There is one `_` for each select branch **before** this one. Given
597 // that all input futures are stored in a tuple, $skip is useful for
598 // generating a pattern to reference the future for the current branch.
599 // $skip is also used as an argument to `count!`, returning the index of
600 // the current select branch.
601 $( ( $($skip:tt)* ) $bind:pat = $fut:expr, if $c:expr => $handle:expr, )+
602
603 // Fallback expression used when all select branches have been disabled.
604 ; $else:expr
605
606 }) => {{
607 // Enter a context where stable "function-like" proc macros can be used.
608 //
609 // This module is defined within a scope and should not leak out of this
610 // macro.
611 #[doc(hidden)]
612 mod __tokio_select_util {
613 // Generate an enum with one variant per select branch
614 $crate::select_priv_declare_output_enum!( ( $($count)* ) );
615 }
616
617 // `tokio::macros::support` is a public, but doc(hidden) module
618 // including a re-export of all types needed by this macro.
619 use $crate::macros::support::Future;
620 use $crate::macros::support::Pin;
621 use $crate::macros::support::Poll::{Ready, Pending};
622
623 const BRANCHES: u32 = $crate::count!( $($count)* );
624
625 let mut disabled: __tokio_select_util::Mask = Default::default();
626
627 // First, invoke all the pre-conditions. For any that return true,
628 // set the appropriate bit in `disabled`.
629 $(
630 if !$c {
631 let mask: __tokio_select_util::Mask = 1 << $crate::count!( $($skip)* );
632 disabled |= mask;
633 }
634 )*
635
636 // Create a scope to separate polling from handling the output. This
637 // adds borrow checker flexibility when using the macro.
638 let mut output = {
639 // Store each future directly first (that is, without wrapping the future in a call to
640 // `IntoFuture::into_future`). This allows the `$fut` expression to make use of
641 // temporary lifetime extension.
642 //
643 // https://doc.rust-lang.org/1.58.1/reference/destructors.html#temporary-lifetime-extension
644 let futures_init = ($( $fut, )+);
645
646 // Safety: Nothing must be moved out of `futures`. This is to
647 // satisfy the requirement of `Pin::new_unchecked` called below.
648 //
649 // We can't use the `pin!` macro for this because `futures` is a
650 // tuple and the standard library provides no way to pin-project to
651 // the fields of a tuple.
652 let mut futures = ($( $crate::macros::support::IntoFuture::into_future(
653 $crate::count_field!( futures_init.$($skip)* )
654 ),)+);
655
656 // This assignment makes sure that the `poll_fn` closure only has a
657 // reference to the futures, instead of taking ownership of them.
658 // This mitigates the issue described in
659 // <https://internals.rust-lang.org/t/surprising-soundness-trouble-around-pollfn/17484>
660 let mut futures = &mut futures;
661
662 $crate::macros::support::poll_fn(|cx| {
663 // Track if any branch returns pending. If no branch completes
664 // **or** returns pending, this implies that all branches are
665 // disabled.
666 let mut is_pending = false;
667
668 // Choose a starting index to begin polling the futures at. In
669 // practice, this will either be a pseudo-randomly generated
670 // number by default, or the constant 0 if `biased;` is
671 // supplied.
672 let start = $start;
673
674 for i in 0..BRANCHES {
675 let branch;
676 #[allow(clippy::modulo_one)]
677 {
678 branch = (start + i) % BRANCHES;
679 }
680 match branch {
681 $(
682 #[allow(unreachable_code)]
683 $crate::count!( $($skip)* ) => {
684 // First, if the future has previously been
685 // disabled, do not poll it again. This is done
686 // by checking the associated bit in the
687 // `disabled` bit field.
688 let mask = 1 << branch;
689
690 if disabled & mask == mask {
691 // The future has been disabled.
692 continue;
693 }
694
695 // Extract the future for this branch from the
696 // tuple
697 let ( $($skip,)* fut, .. ) = &mut *futures;
698
699 // Safety: future is stored on the stack above
700 // and never moved.
701 let mut fut = unsafe { Pin::new_unchecked(fut) };
702
703 // Try polling it
704 let out = match Future::poll(fut, cx) {
705 Ready(out) => out,
706 Pending => {
707 // Track that at least one future is
708 // still pending and continue polling.
709 is_pending = true;
710 continue;
711 }
712 };
713
714 // Disable the future from future polling.
715 disabled |= mask;
716
717 // The future returned a value, check if matches
718 // the specified pattern.
719 #[allow(unused_variables)]
720 #[allow(unused_mut)]
721 match &out {
722 $crate::select_priv_clean_pattern!($bind) => {}
723 _ => continue,
724 }
725
726 // The select is complete, return the value
727 return Ready($crate::select_variant!(__tokio_select_util::Out, ($($skip)*))(out));
728 }
729 )*
730 _ => unreachable!("reaching this means there probably is an off by one bug"),
731 }
732 }
733
734 if is_pending {
735 Pending
736 } else {
737 // All branches have been disabled.
738 Ready(__tokio_select_util::Out::Disabled)
739 }
740 }).await
741 };
742
743 match output {
744 $(
745 $crate::select_variant!(__tokio_select_util::Out, ($($skip)*) ($bind)) => $handle,
746 )*
747 __tokio_select_util::Out::Disabled => $else,
748 _ => unreachable!("failed to match bind"),
749 }
750 }};
751
752 // ==== Normalize =====
753
754 // These rules match a single `select!` branch and normalize it for
755 // processing by the first rule.
756
757 (@ { start=$start:expr; $($t:tt)* } ) => {
758 // No `else` branch
759 $crate::select!(@{ start=$start; $($t)*; panic!("all branches are disabled and there is no else branch") })
760 };
761 (@ { start=$start:expr; $($t:tt)* } else => $else:expr $(,)?) => {
762 $crate::select!(@{ start=$start; $($t)*; $else })
763 };
764 (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr, if $c:expr => $h:block, $($r:tt)* ) => {
765 $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if $c => $h, } $($r)*)
766 };
767 (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr => $h:block, $($r:tt)* ) => {
768 $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if true => $h, } $($r)*)
769 };
770 (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr, if $c:expr => $h:block $($r:tt)* ) => {
771 $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if $c => $h, } $($r)*)
772 };
773 (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr => $h:block $($r:tt)* ) => {
774 $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if true => $h, } $($r)*)
775 };
776 (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr, if $c:expr => $h:expr ) => {
777 $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if $c => $h, })
778 };
779 (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr => $h:expr ) => {
780 $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if true => $h, })
781 };
782 (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr, if $c:expr => $h:expr, $($r:tt)* ) => {
783 $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if $c => $h, } $($r)*)
784 };
785 (@ { start=$start:expr; ( $($s:tt)* ) $($t:tt)* } $p:pat = $f:expr => $h:expr, $($r:tt)* ) => {
786 $crate::select!(@{ start=$start; ($($s)* _) $($t)* ($($s)*) $p = $f, if true => $h, } $($r)*)
787 };
788
789 // ===== Entry point =====
790
791 ($(biased;)? else => $else:expr $(,)? ) => {{
792 $else
793 }};
794
795 (biased; $p:pat = $($t:tt)* ) => {
796 $crate::select!(@{ start=0; () } $p = $($t)*)
797 };
798
799 ( $p:pat = $($t:tt)* ) => {
800 // Randomly generate a starting point. This makes `select!` a bit more
801 // fair and avoids always polling the first future.
802 $crate::select!(@{ start={ $crate::macros::support::thread_rng_n(BRANCHES) }; () } $p = $($t)*)
803 };
804
805 () => {
806 compile_error!("select! requires at least one branch.")
807 };
808}}
809
810// And here... we manually list out matches for up to 64 branches... I'm not
811// happy about it either, but this is how we manage to use a declarative macro!
812
813#[macro_export]
814#[doc(hidden)]
815macro_rules! count {
816 () => {
817 0
818 };
819 (_) => {
820 1
821 };
822 (_ _) => {
823 2
824 };
825 (_ _ _) => {
826 3
827 };
828 (_ _ _ _) => {
829 4
830 };
831 (_ _ _ _ _) => {
832 5
833 };
834 (_ _ _ _ _ _) => {
835 6
836 };
837 (_ _ _ _ _ _ _) => {
838 7
839 };
840 (_ _ _ _ _ _ _ _) => {
841 8
842 };
843 (_ _ _ _ _ _ _ _ _) => {
844 9
845 };
846 (_ _ _ _ _ _ _ _ _ _) => {
847 10
848 };
849 (_ _ _ _ _ _ _ _ _ _ _) => {
850 11
851 };
852 (_ _ _ _ _ _ _ _ _ _ _ _) => {
853 12
854 };
855 (_ _ _ _ _ _ _ _ _ _ _ _ _) => {
856 13
857 };
858 (_ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
859 14
860 };
861 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
862 15
863 };
864 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
865 16
866 };
867 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
868 17
869 };
870 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
871 18
872 };
873 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
874 19
875 };
876 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
877 20
878 };
879 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
880 21
881 };
882 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
883 22
884 };
885 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
886 23
887 };
888 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
889 24
890 };
891 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
892 25
893 };
894 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
895 26
896 };
897 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
898 27
899 };
900 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
901 28
902 };
903 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
904 29
905 };
906 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
907 30
908 };
909 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
910 31
911 };
912 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
913 32
914 };
915 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
916 33
917 };
918 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
919 34
920 };
921 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
922 35
923 };
924 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
925 36
926 };
927 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
928 37
929 };
930 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
931 38
932 };
933 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
934 39
935 };
936 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
937 40
938 };
939 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
940 41
941 };
942 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
943 42
944 };
945 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
946 43
947 };
948 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
949 44
950 };
951 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
952 45
953 };
954 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
955 46
956 };
957 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
958 47
959 };
960 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
961 48
962 };
963 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
964 49
965 };
966 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
967 50
968 };
969 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
970 51
971 };
972 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
973 52
974 };
975 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
976 53
977 };
978 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
979 54
980 };
981 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
982 55
983 };
984 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
985 56
986 };
987 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
988 57
989 };
990 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
991 58
992 };
993 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
994 59
995 };
996 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
997 60
998 };
999 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1000 61
1001 };
1002 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1003 62
1004 };
1005 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1006 63
1007 };
1008 (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1009 64
1010 };
1011}
1012
1013#[macro_export]
1014#[doc(hidden)]
1015macro_rules! count_field {
1016 ($var:ident. ) => {
1017 $var.0
1018 };
1019 ($var:ident. _) => {
1020 $var.1
1021 };
1022 ($var:ident. _ _) => {
1023 $var.2
1024 };
1025 ($var:ident. _ _ _) => {
1026 $var.3
1027 };
1028 ($var:ident. _ _ _ _) => {
1029 $var.4
1030 };
1031 ($var:ident. _ _ _ _ _) => {
1032 $var.5
1033 };
1034 ($var:ident. _ _ _ _ _ _) => {
1035 $var.6
1036 };
1037 ($var:ident. _ _ _ _ _ _ _) => {
1038 $var.7
1039 };
1040 ($var:ident. _ _ _ _ _ _ _ _) => {
1041 $var.8
1042 };
1043 ($var:ident. _ _ _ _ _ _ _ _ _) => {
1044 $var.9
1045 };
1046 ($var:ident. _ _ _ _ _ _ _ _ _ _) => {
1047 $var.10
1048 };
1049 ($var:ident. _ _ _ _ _ _ _ _ _ _ _) => {
1050 $var.11
1051 };
1052 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _) => {
1053 $var.12
1054 };
1055 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1056 $var.13
1057 };
1058 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1059 $var.14
1060 };
1061 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1062 $var.15
1063 };
1064 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1065 $var.16
1066 };
1067 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1068 $var.17
1069 };
1070 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1071 $var.18
1072 };
1073 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1074 $var.19
1075 };
1076 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1077 $var.20
1078 };
1079 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1080 $var.21
1081 };
1082 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1083 $var.22
1084 };
1085 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1086 $var.23
1087 };
1088 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1089 $var.24
1090 };
1091 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1092 $var.25
1093 };
1094 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1095 $var.26
1096 };
1097 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1098 $var.27
1099 };
1100 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1101 $var.28
1102 };
1103 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1104 $var.29
1105 };
1106 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1107 $var.30
1108 };
1109 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1110 $var.31
1111 };
1112 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1113 $var.32
1114 };
1115 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1116 $var.33
1117 };
1118 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1119 $var.34
1120 };
1121 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1122 $var.35
1123 };
1124 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1125 $var.36
1126 };
1127 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1128 $var.37
1129 };
1130 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1131 $var.38
1132 };
1133 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1134 $var.39
1135 };
1136 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1137 $var.40
1138 };
1139 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1140 $var.41
1141 };
1142 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1143 $var.42
1144 };
1145 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1146 $var.43
1147 };
1148 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1149 $var.44
1150 };
1151 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1152 $var.45
1153 };
1154 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1155 $var.46
1156 };
1157 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1158 $var.47
1159 };
1160 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1161 $var.48
1162 };
1163 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1164 $var.49
1165 };
1166 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1167 $var.50
1168 };
1169 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1170 $var.51
1171 };
1172 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1173 $var.52
1174 };
1175 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1176 $var.53
1177 };
1178 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1179 $var.54
1180 };
1181 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1182 $var.55
1183 };
1184 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1185 $var.56
1186 };
1187 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1188 $var.57
1189 };
1190 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1191 $var.58
1192 };
1193 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1194 $var.59
1195 };
1196 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1197 $var.60
1198 };
1199 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1200 $var.61
1201 };
1202 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1203 $var.62
1204 };
1205 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1206 $var.63
1207 };
1208 ($var:ident. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) => {
1209 $var.64
1210 };
1211}
1212
1213#[macro_export]
1214#[doc(hidden)]
1215macro_rules! select_variant {
1216 ($($p:ident)::*, () $($t:tt)*) => {
1217 $($p)::*::_0 $($t)*
1218 };
1219 ($($p:ident)::*, (_) $($t:tt)*) => {
1220 $($p)::*::_1 $($t)*
1221 };
1222 ($($p:ident)::*, (_ _) $($t:tt)*) => {
1223 $($p)::*::_2 $($t)*
1224 };
1225 ($($p:ident)::*, (_ _ _) $($t:tt)*) => {
1226 $($p)::*::_3 $($t)*
1227 };
1228 ($($p:ident)::*, (_ _ _ _) $($t:tt)*) => {
1229 $($p)::*::_4 $($t)*
1230 };
1231 ($($p:ident)::*, (_ _ _ _ _) $($t:tt)*) => {
1232 $($p)::*::_5 $($t)*
1233 };
1234 ($($p:ident)::*, (_ _ _ _ _ _) $($t:tt)*) => {
1235 $($p)::*::_6 $($t)*
1236 };
1237 ($($p:ident)::*, (_ _ _ _ _ _ _) $($t:tt)*) => {
1238 $($p)::*::_7 $($t)*
1239 };
1240 ($($p:ident)::*, (_ _ _ _ _ _ _ _) $($t:tt)*) => {
1241 $($p)::*::_8 $($t)*
1242 };
1243 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1244 $($p)::*::_9 $($t)*
1245 };
1246 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1247 $($p)::*::_10 $($t)*
1248 };
1249 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1250 $($p)::*::_11 $($t)*
1251 };
1252 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1253 $($p)::*::_12 $($t)*
1254 };
1255 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1256 $($p)::*::_13 $($t)*
1257 };
1258 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1259 $($p)::*::_14 $($t)*
1260 };
1261 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1262 $($p)::*::_15 $($t)*
1263 };
1264 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1265 $($p)::*::_16 $($t)*
1266 };
1267 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1268 $($p)::*::_17 $($t)*
1269 };
1270 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1271 $($p)::*::_18 $($t)*
1272 };
1273 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1274 $($p)::*::_19 $($t)*
1275 };
1276 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1277 $($p)::*::_20 $($t)*
1278 };
1279 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1280 $($p)::*::_21 $($t)*
1281 };
1282 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1283 $($p)::*::_22 $($t)*
1284 };
1285 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1286 $($p)::*::_23 $($t)*
1287 };
1288 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1289 $($p)::*::_24 $($t)*
1290 };
1291 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1292 $($p)::*::_25 $($t)*
1293 };
1294 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1295 $($p)::*::_26 $($t)*
1296 };
1297 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1298 $($p)::*::_27 $($t)*
1299 };
1300 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1301 $($p)::*::_28 $($t)*
1302 };
1303 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1304 $($p)::*::_29 $($t)*
1305 };
1306 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1307 $($p)::*::_30 $($t)*
1308 };
1309 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1310 $($p)::*::_31 $($t)*
1311 };
1312 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1313 $($p)::*::_32 $($t)*
1314 };
1315 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1316 $($p)::*::_33 $($t)*
1317 };
1318 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1319 $($p)::*::_34 $($t)*
1320 };
1321 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1322 $($p)::*::_35 $($t)*
1323 };
1324 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1325 $($p)::*::_36 $($t)*
1326 };
1327 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1328 $($p)::*::_37 $($t)*
1329 };
1330 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1331 $($p)::*::_38 $($t)*
1332 };
1333 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1334 $($p)::*::_39 $($t)*
1335 };
1336 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1337 $($p)::*::_40 $($t)*
1338 };
1339 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1340 $($p)::*::_41 $($t)*
1341 };
1342 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1343 $($p)::*::_42 $($t)*
1344 };
1345 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1346 $($p)::*::_43 $($t)*
1347 };
1348 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1349 $($p)::*::_44 $($t)*
1350 };
1351 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1352 $($p)::*::_45 $($t)*
1353 };
1354 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1355 $($p)::*::_46 $($t)*
1356 };
1357 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1358 $($p)::*::_47 $($t)*
1359 };
1360 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1361 $($p)::*::_48 $($t)*
1362 };
1363 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1364 $($p)::*::_49 $($t)*
1365 };
1366 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1367 $($p)::*::_50 $($t)*
1368 };
1369 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1370 $($p)::*::_51 $($t)*
1371 };
1372 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1373 $($p)::*::_52 $($t)*
1374 };
1375 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1376 $($p)::*::_53 $($t)*
1377 };
1378 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1379 $($p)::*::_54 $($t)*
1380 };
1381 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1382 $($p)::*::_55 $($t)*
1383 };
1384 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1385 $($p)::*::_56 $($t)*
1386 };
1387 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1388 $($p)::*::_57 $($t)*
1389 };
1390 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1391 $($p)::*::_58 $($t)*
1392 };
1393 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1394 $($p)::*::_59 $($t)*
1395 };
1396 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1397 $($p)::*::_60 $($t)*
1398 };
1399 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1400 $($p)::*::_61 $($t)*
1401 };
1402 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1403 $($p)::*::_62 $($t)*
1404 };
1405 ($($p:ident)::*, (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) $($t:tt)*) => {
1406 $($p)::*::_63 $($t)*
1407 };
1408}