(attrs: &[Attribute])
| 5 | use syn::{Attribute, Data, DeriveInput, LitStr, Variant}; |
| 6 | |
| 7 | fn extract_atom_string(attrs: &[Attribute]) -> Option<String> { |
| 8 | for attr in attrs { |
| 9 | if attr.path().is_ident("atom") |
| 10 | && let Ok(list) = attr.meta.require_list() |
| 11 | && let Ok(lit_str) = syn::parse2::<LitStr>(list.tokens.clone()) |
| 12 | { |
| 13 | return Some(lit_str.value()); |
| 14 | } |
| 15 | } |
| 16 | None |
| 17 | } |
| 18 | |
| 19 | fn has_attribute(attrs: &[Attribute], name: &str) -> bool { |
| 20 | attrs.iter().any(|attr| attr.path().is_ident(name)) |