summaryrefslogtreecommitdiff
path: root/src/func/macros.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-12-13 23:59:01 +0100
committerLaurenz <laurmaedje@gmail.com>2019-12-13 23:59:01 +0100
commit665b4d2aca81af48b8e0eaca4e709ef2e7825844 (patch)
tree4ada33f607455f14b6a170fe4b7fbe173056567b /src/func/macros.rs
parent971ff3a2dcff1e68bf7e19017113469aad5a30c2 (diff)
More consistent library code and functions 🎄
Diffstat (limited to 'src/func/macros.rs')
-rw-r--r--src/func/macros.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/func/macros.rs b/src/func/macros.rs
index 17a554cf..df795213 100644
--- a/src/func/macros.rs
+++ b/src/func/macros.rs
@@ -5,22 +5,25 @@
macro_rules! function {
// Parse a unit struct.
($(#[$outer:meta])* pub struct $type:ident; $($rest:tt)*) => {
- $(#[$outer])*
- pub struct $type;
+ $(#[$outer])* pub struct $type;
function!(@meta $type | $($rest)*);
};
// Parse a tuple struct.
($(#[$outer:meta])* pub struct $type:ident($($fields:tt)*); $($rest:tt)*) => {
- $(#[$outer])*
- pub struct $type($($fields)*);
+ $(#[$outer])* pub struct $type($($fields)*);
function!(@meta $type | $($rest)*);
};
// Parse a struct with fields.
($(#[$outer:meta])* pub struct $type:ident { $($fields:tt)* } $($rest:tt)*) => {
- $(#[$outer])*
- pub struct $type { $($fields)* }
+ $(#[$outer])* pub struct $type { $($fields)* }
+ function!(@meta $type | $($rest)*);
+ };
+
+ // Parse an enum.
+ ($(#[$outer:meta])* pub enum $type:ident { $($fields:tt)* } $($rest:tt)*) => {
+ $(#[$outer])* pub enum $type { $($fields)* }
function!(@meta $type | $($rest)*);
};