| 7 | use css_value_definition_parser::*; |
| 8 | |
| 9 | fn has_derive_of(attrs: &[Attribute], name: &'static str) -> bool { |
| 10 | for attr in attrs { |
| 11 | if attr.path().is_ident("derive") { |
| 12 | let nested = attr.parse_args_with(Punctuated::<Meta, Token![,]>::parse_terminated).unwrap_or_default(); |
| 13 | for meta in nested { |
| 14 | match meta { |
| 15 | Meta::Path(path) |
| 16 | if path.is_ident(name) || path.segments.last().map(|s| s.ident == name).unwrap_or(false) => |
| 17 | { |
| 18 | return true; |
| 19 | } |
| 20 | _ => {} |
| 21 | } |
| 22 | } |
| 23 | } |
| 24 | } |
| 25 | false |
| 26 | } |
| 27 | |
| 28 | pub fn generate(defs: Def, ast: DeriveInput) -> TokenStream { |
| 29 | let has_a_lifetime = ast.generics.lifetimes().any(|l| l.lifetime.ident == "a"); |