(
is_debug: bool,
attributes: &[syn::Attribute],
)
| 32 | } |
| 33 | |
| 34 | fn has_qsync_attribute( |
| 35 | is_debug: bool, |
| 36 | attributes: &[syn::Attribute], |
| 37 | ) -> Option<QsyncAttributeProps> { |
| 38 | let mut is_mutation: Option<bool> = None; |
| 39 | let mut return_type = "TODO".to_string(); |
| 40 | |
| 41 | let mut has_actix_attribute = false; |
| 42 | let mut has_qsync_attribute = false; |
| 43 | |
| 44 | for attr in attributes { |
| 45 | if is_debug { |
| 46 | let attr_path = attr |
| 47 | .path |
| 48 | .segments |
| 49 | .iter() |
| 50 | .map(|r| r.ident.to_string()) |
| 51 | .collect::<Vec<String>>() |
| 52 | .join("::"); |
| 53 | println!("\tFound attribute '{}'", &attr_path); |
| 54 | } |
| 55 | |
| 56 | let meta = attr.parse_meta(); |
| 57 | |
| 58 | if meta.is_err() { |
| 59 | if is_debug { |
| 60 | println!("\t> could not parse attribute as `Meta`"); |
| 61 | } |
| 62 | continue; |
| 63 | } |
| 64 | |
| 65 | let meta = meta.unwrap(); |
| 66 | |
| 67 | // extract and compare against attribute's identifier (#[path::to::identifier]) |
| 68 | let attr_identifier = meta |
| 69 | .path() |
| 70 | .segments |
| 71 | .last() |
| 72 | .map(|r| r.ident.to_string()) |
| 73 | .unwrap_or_default(); |
| 74 | |
| 75 | match attr_identifier.as_str() { |
| 76 | "qsync" => { |
| 77 | has_qsync_attribute = true; |
| 78 | |
| 79 | let args = MacroArgs::from_meta(&meta); |
| 80 | if args.is_err() { |
| 81 | if is_debug { |
| 82 | println!("qsync error reading attribute args: {:?}", &args.err()); |
| 83 | } |
| 84 | continue; |
| 85 | } |
| 86 | let args = args.unwrap(); |
| 87 | |
| 88 | if args.mutate.is_some() { |
| 89 | is_mutation = args.mutate; |
| 90 | } |
| 91 | if args.return_type.is_some() { |
no test coverage detected