| 31 | impl TryFrom<&[Attribute]> for CSSFeatureName { |
| 32 | type Error = Error; |
| 33 | fn try_from(attrs: &[Attribute]) -> Result<Self> { |
| 34 | if let Some(Attribute { meta, .. }) = &attrs.iter().find(|a| a.path().is_ident("css_feature")) { |
| 35 | match meta { |
| 36 | // #[css_feature("foo")] |
| 37 | Meta::List(meta) => meta.parse_args::<Self>(), |
| 38 | // #[visit] |
| 39 | _ => Err(Error::new(Span::call_site(), "`css_feature` attribute has no value")), |
| 40 | } |
| 41 | } else { |
| 42 | Err(Error::new(Span::call_site(), "Missing `css_feature` attribute")) |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | fn by_feature_name(feature: String) -> TokenStream { |