diff options
author | HampusM <hampus@hampusmat.com> | 2022-08-29 20:52:56 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-08-29 21:01:32 +0200 |
commit | 080cc42bb1da09059dbc35049a7ded0649961e0c (patch) | |
tree | 307ee564124373616022c1ba2b4d5af80845cd92 /macros/src/macro_flag.rs | |
parent | 6e31d8f9e46fece348f329763b39b9c6f2741c07 (diff) |
feat: implement async functionality
Diffstat (limited to 'macros/src/macro_flag.rs')
-rw-r--r-- | macros/src/macro_flag.rs | 27 |
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 }) + } +} |