MCPcopy Create free account
hub / github.com/csskit/csskit / atom_from_attrs

Function atom_from_attrs

crates/csskit_derives/src/feature_metadata.rs:6–11  ·  view source on GitHub ↗

Reads `#[feature_metadata(CssAtomSet::Foo)]` from the type's attributes.

(attrs: &[syn::Attribute])

Source from the content-addressed store, hash-verified

4
5/// Reads `#[feature_metadata(CssAtomSet::Foo)]` from the type's attributes.
6pub(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
13pub fn derive(input: DeriveInput) -> Result<TokenStream> {
14 let atom = atom_from_attrs(&input.attrs).ok_or_else(|| {

Callers 1

deriveFunction · 0.85

Calls 3

iterMethod · 0.80
pathMethod · 0.80
okMethod · 0.80

Tested by

no test coverage detected