1 | //! |
2 | //! Implementation's internal macros |
3 | |
4 | macro_rules! debug_fmt_fields { |
5 | ($tyname:ident, $($($field:tt/*TODO ideally we would accept ident or tuple element here*/).+),*) => { |
6 | fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { |
7 | f.debug_struct(stringify!($tyname)) |
8 | $( |
9 | .field(stringify!($($field).+), &self.$($field).+) |
10 | )* |
11 | .finish() |
12 | } |
13 | } |
14 | } |
15 | |
16 | macro_rules! clone_fields { |
17 | ($($field:ident),*) => { |
18 | #[inline] // TODO is this sensible? |
19 | fn clone(&self) -> Self { |
20 | Self { |
21 | $($field: self.$field.clone(),)* |
22 | } |
23 | } |
24 | } |
25 | } |
26 | |
27 | macro_rules! ignore_ident{ |
28 | ($id:ident, $($t:tt)*) => {$($t)*}; |
29 | } |
30 | |
31 | macro_rules! count_ident { |
32 | () => {0}; |
33 | ($i0:ident $($i:ident)*) => {1 + count_ident!($($i)*)}; |
34 | } |
35 | |