aboutsummaryrefslogtreecommitdiff
path: root/macros/src/macro_flag.rs
diff options
context:
space:
mode:
Diffstat (limited to 'macros/src/macro_flag.rs')
-rw-r--r--macros/src/macro_flag.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/macros/src/macro_flag.rs b/macros/src/macro_flag.rs
new file mode 100644
index 0000000..257a059
--- /dev/null
+++ b/macros/src/macro_flag.rs
@@ -0,0 +1,27 @@
+use syn::parse::{Parse, ParseStream};
+use syn::{Ident, LitBool, Token};
+
+#[derive(Debug)]
+pub struct MacroFlag
+{
+ pub flag: Ident,
+ pub is_on: LitBool,
+}
+
+impl Parse for MacroFlag
+{
+ fn parse(input: ParseStream) -> syn::Result<Self>
+ {
+ let input_forked = input.fork();
+
+ let flag: Ident = input_forked.parse()?;
+
+ input.parse::<Ident>()?;
+
+ input.parse::<Token![=]>()?;
+
+ let is_on: LitBool = input.parse()?;
+
+ Ok(Self { flag, is_on })
+ }
+}