1use crate::{uDebug, uWrite, Formatter};
2
3macro_rules! tuple {
4 ($($T:ident),*; $($i:tt),*) => {
5 impl<$($T,)*> uDebug for ($($T,)*)
6 where
7 $($T: uDebug,)*
8 {
9 fn fmt<W>(&self, f: &mut Formatter<'_, W>) -> Result<(), W::Error>
10 where
11 W: uWrite + ?Sized,
12 {
13 f.debug_tuple("")?$(.field(&self.$i)?)*.finish()
14 }
15 }
16
17 }
18}
19
20impl uDebug for () {
21 fn fmt<W>(&self, f: &mut Formatter<'_, W>) -> Result<(), W::Error>
22 where
23 W: uWrite + ?Sized,
24 {
25 f.write_str("()")
26 }
27}
28
29tuple!(A; 0);
30tuple!(A, B; 0, 1);
31tuple!(A, B, C; 0, 1, 2);
32tuple!(A, B, C, D; 0, 1, 2, 3);
33tuple!(A, B, C, D, E; 0, 1, 2, 3, 4);
34tuple!(A, B, C, D, E, F; 0, 1, 2, 3, 4, 5);
35tuple!(A, B, C, D, E, F, G; 0, 1, 2, 3, 4, 5, 6);
36tuple!(A, B, C, D, E, F, G, H; 0, 1, 2, 3, 4, 5, 6, 7);
37tuple!(A, B, C, D, E, F, G, H, I; 0, 1, 2, 3, 4, 5, 6, 7, 8);
38tuple!(A, B, C, D, E, F, G, H, I, J; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
39tuple!(A, B, C, D, E, F, G, H, I, J, K; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
40tuple!(A, B, C, D, E, F, G, H, I, J, K, L; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);