summaryrefslogtreecommitdiffstats
path: root/third_party/rust/itertools/src/impl_macros.rs
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/itertools/src/impl_macros.rs')
-rw-r--r--third_party/rust/itertools/src/impl_macros.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/third_party/rust/itertools/src/impl_macros.rs b/third_party/rust/itertools/src/impl_macros.rs
new file mode 100644
index 0000000000..a029843b05
--- /dev/null
+++ b/third_party/rust/itertools/src/impl_macros.rs
@@ -0,0 +1,29 @@
+//!
+//! Implementation's internal macros
+
+macro_rules! debug_fmt_fields {
+ ($tyname:ident, $($($field:tt/*TODO ideally we would accept ident or tuple element here*/).+),*) => {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ f.debug_struct(stringify!($tyname))
+ $(
+ .field(stringify!($($field).+), &self.$($field).+)
+ )*
+ .finish()
+ }
+ }
+}
+
+macro_rules! clone_fields {
+ ($($field:ident),*) => {
+ #[inline] // TODO is this sensible?
+ fn clone(&self) -> Self {
+ Self {
+ $($field: self.$field.clone(),)*
+ }
+ }
+ }
+}
+
+macro_rules! ignore_ident{
+ ($id:ident, $($t:tt)*) => {$($t)*};
+}