Jakub Kotur | a425e55 | 2020-12-21 17:28:15 +0100 | [diff] [blame] | 1 | //! |
| 2 | //! Implementation's internal macros |
| 3 | |
| 4 | macro_rules! debug_fmt_fields { |
David LeGare | b72e905 | 2022-03-02 16:21:08 +0000 | [diff] [blame] | 5 | ($tyname:ident, $($($field:tt/*TODO ideally we would accept ident or tuple element here*/).+),*) => { |
Jakub Kotur | a425e55 | 2020-12-21 17:28:15 +0100 | [diff] [blame] | 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),*) => { |
Jeff Vander Stoep | 36c9ead | 2022-12-12 13:40:25 +0100 | [diff] [blame] | 18 | #[inline] // TODO is this sensible? |
Jakub Kotur | a425e55 | 2020-12-21 17:28:15 +0100 | [diff] [blame] | 19 | fn clone(&self) -> Self { |
| 20 | Self { |
| 21 | $($field: self.$field.clone(),)* |
| 22 | } |
| 23 | } |
| 24 | } |
| 25 | } |
Joel Galenson | b593e25 | 2021-06-21 13:15:57 -0700 | [diff] [blame] | 26 | |
| 27 | macro_rules! ignore_ident{ |
| 28 | ($id:ident, $($t:tt)*) => {$($t)*}; |
| 29 | } |