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

Function has_feature_metadata

crates/csskit_derives/src/visitable.rs:73–84  ·  view source on GitHub ↗

Returns true if `#[derive(... FeatureMetadata ...)]` is present on the type, indicating `visit_feature`/`exit_feature` calls should be emitted in `accept()`.

(attrs: &[Attribute])

Source from the content-addressed store, hash-verified

71/// Returns true if `#[derive(... FeatureMetadata ...)]` is present on the type,
72/// indicating `visit_feature`/`exit_feature` calls should be emitted in `accept()`.
73fn has_feature_metadata(attrs: &[Attribute]) -> bool {
74 attrs.iter().any(|attr| {
75 if !attr.path().is_ident("derive") {
76 return false;
77 }
78 let Meta::List(list) = &attr.meta else { return false };
79 // Parse as comma-separated paths and check for FeatureMetadata
80 list.parse_args_with(syn::punctuated::Punctuated::<syn::Path, syn::Token![,]>::parse_terminated)
81 .map(|paths| paths.iter().any(|p| p.is_ident("FeatureMetadata")))
82 .unwrap_or(false)
83 })
84}
85
86fn make_body(s: &Structure, accept: &syn::Ident, wc: &mut WhereCollector, use_try_visit: bool) -> TokenStream {
87 match &s.ast().data {

Callers 1

deriveFunction · 0.85

Calls 2

iterMethod · 0.80
pathMethod · 0.80

Tested by

no test coverage detected