diff options
Diffstat (limited to 'src/macros.rs')
-rw-r--r-- | src/macros.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/macros.rs b/src/macros.rs index 7a0eb07c..39bc466d 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -379,6 +379,23 @@ macro_rules! libc_enum { } }; + // Munch an ident and cast it to the given type; covers terminating comma. + (@accumulate_entries + $prefix:tt, + [$($entries:tt)*]; + $entry:ident as $ty:ty, $($tail:tt)* + ) => { + libc_enum! { + @accumulate_entries + $prefix, + [ + $($entries)* + $entry = libc::$entry as $ty, + ]; + $($tail)* + } + }; + // (non-pub) Entry rule. ( $(#[$attr:meta])* |