Reads `#[feature_metadata(CssAtomSet::Foo)]` from the type's attributes.
(attrs: &[syn::Attribute])
| 4 | |
| 5 | /// Reads `#[feature_metadata(CssAtomSet::Foo)]` from the type's attributes. |
| 6 | pub(crate) fn atom_from_attrs(attrs: &[syn::Attribute]) -> Option<Path> { |
| 7 | attrs.iter().find(|a| a.path().is_ident("feature_metadata")).and_then(|attr| match &attr.meta { |
| 8 | Meta::List(meta) => meta.parse_args::<Path>().ok(), |
| 9 | _ => None, |
| 10 | }) |
| 11 | } |
| 12 | |
| 13 | pub fn derive(input: DeriveInput) -> Result<TokenStream> { |
| 14 | let atom = atom_from_attrs(&input.attrs).ok_or_else(|| { |