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

Function extract_atom_string

crates/derive_atom_set/src/atom_set.rs:7–17  ·  view source on GitHub ↗
(attrs: &[Attribute])

Source from the content-addressed store, hash-verified

5use syn::{Attribute, Data, DeriveInput, LitStr, Variant};
6
7fn extract_atom_string(attrs: &[Attribute]) -> Option<String> {
8 for attr in attrs {
9 if attr.path().is_ident("atom")
10 && let Ok(list) = attr.meta.require_list()
11 && let Ok(lit_str) = syn::parse2::<LitStr>(list.tokens.clone())
12 {
13 return Some(lit_str.value());
14 }
15 }
16 None
17}
18
19fn has_attribute(attrs: &[Attribute], name: &str) -> bool {
20 attrs.iter().any(|attr| attr.path().is_ident(name))

Callers 1

generateFunction · 0.85

Calls 3

pathMethod · 0.80
cloneMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected