blob: a029843b05ff2ef7d6c27107e608bbea6b0ee8c1 [file] [log] [blame]
Jakub Kotura425e552020-12-21 17:28:15 +01001//!
2//! Implementation's internal macros
3
4macro_rules! debug_fmt_fields {
David LeGareb72e9052022-03-02 16:21:08 +00005 ($tyname:ident, $($($field:tt/*TODO ideally we would accept ident or tuple element here*/).+),*) => {
Jakub Kotura425e552020-12-21 17:28:15 +01006 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
16macro_rules! clone_fields {
17 ($($field:ident),*) => {
Jeff Vander Stoep36c9ead2022-12-12 13:40:25 +010018 #[inline] // TODO is this sensible?
Jakub Kotura425e552020-12-21 17:28:15 +010019 fn clone(&self) -> Self {
20 Self {
21 $($field: self.$field.clone(),)*
22 }
23 }
24 }
25}
Joel Galensonb593e252021-06-21 13:15:57 -070026
27macro_rules! ignore_ident{
28 ($id:ident, $($t:tt)*) => {$($t)*};
29}