defmt/impls/
arrays.rs

1use super::*;
2use crate::export;
3
4macro_rules! arrays {
5    ( $($len:literal $fmt:literal,)+ ) => {
6        impl<T, const N: usize> Format for [T; N]
7        where
8            T: Format
9        {
10            default_format!();
11
12            #[inline]
13            fn _format_tag() -> Str {
14                match N {
15                    $(
16                        $len => internp!($fmt),
17                    )+
18                    _ => internp!("{=[?]}"),
19                }
20            }
21
22            #[inline]
23            fn _format_data(&self) {
24                match N {
25                    $( $len )|+ => export::fmt_array(self),
26                    _ => export::fmt_slice(self),
27                }
28            }
29        }
30    };
31}
32
33arrays! {
34    0 "{=[?;0]}",
35    1 "{=[?;1]}",
36    2 "{=[?;2]}",
37    3 "{=[?;3]}",
38    4 "{=[?;4]}",
39    5 "{=[?;5]}",
40    6 "{=[?;6]}",
41    7 "{=[?;7]}",
42    8 "{=[?;8]}",
43    9 "{=[?;9]}",
44    10 "{=[?;10]}",
45    11 "{=[?;11]}",
46    12 "{=[?;12]}",
47    13 "{=[?;13]}",
48    14 "{=[?;14]}",
49    15 "{=[?;15]}",
50    16 "{=[?;16]}",
51    17 "{=[?;17]}",
52    18 "{=[?;18]}",
53    19 "{=[?;19]}",
54    20 "{=[?;20]}",
55    21 "{=[?;21]}",
56    22 "{=[?;22]}",
57    23 "{=[?;23]}",
58    24 "{=[?;24]}",
59    25 "{=[?;25]}",
60    26 "{=[?;26]}",
61    27 "{=[?;27]}",
62    28 "{=[?;28]}",
63    29 "{=[?;29]}",
64    30 "{=[?;30]}",
65    31 "{=[?;31]}",
66    32 "{=[?;32]}",
67    64 "{=[?;64]}",
68    128 "{=[?;128]}",
69    256 "{=[?;256]}",
70    512 "{=[?;512]}",
71    1024 "{=[?;1024]}",
72    2048 "{=[?;2048]}",
73    4096 "{=[?;4096]}",
74    8192 "{=[?;8192]}",
75    16384 "{=[?;16384]}",
76    32768 "{=[?;32768]}",
77    65536 "{=[?;65536]}",
78    131072 "{=[?;131072]}",
79    262144 "{=[?;262144]}",
80    524288 "{=[?;524288]}",
81    1048576 "{=[?;1048576]}",
82    2097152 "{=[?;2097152]}",
83    4194304 "{=[?;4194304]}",
84    8388608 "{=[?;8388608]}",
85    16777216 "{=[?;16777216]}",
86    33554432 "{=[?;33554432]}",
87    67108864 "{=[?;67108864]}",
88    134217728 "{=[?;134217728]}",
89    268435456 "{=[?;268435456]}",
90    536870912 "{=[?;536870912]}",
91    1073741824 "{=[?;1073741824]}",
92    100 "{=[?;100]}",
93    1000 "{=[?;1000]}",
94    10000 "{=[?;10000]}",
95    100000 "{=[?;100000]}",
96    1000000 "{=[?;1000000]}",
97    10000000 "{=[?;10000000]}",
98    100000000 "{=[?;100000000]}",
99    1000000000 "{=[?;1000000000]}",
100}