Created
June 28, 2025 21:17
-
-
Save freedomtowin/ec1c0074b55dea1579398d746caf1101 to your computer and use it in GitHub Desktop.
Example of creating a Gist using Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let mut log_time = false; | |
| let mut log_ret = false; | |
| // Create parser | |
| let arg_parser = syn::meta::parser(|meta| { | |
| if meta.path.is_ident("time") { | |
| log_time = true; | |
| Ok(()) | |
| } else if meta.path.is_ident("ret") { | |
| log_ret = true; | |
| Ok(()) | |
| } else { | |
| // propagate errors | |
| Err(meta.error("expected `time` or `ret`")) | |
| } | |
| }); | |
| let _ = parse_macro_input!(attr with arg_parser); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment