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

Method try_from

crates/csskit_derives/src/css_feature.rs:33–44  ·  view source on GitHub ↗
(attrs: &[Attribute])

Source from the content-addressed store, hash-verified

31impl 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
47fn by_feature_name(feature: String) -> TokenStream {

Callers

nothing calls this directly

Calls 3

ErrClass · 0.85
iterMethod · 0.80
pathMethod · 0.80

Tested by

no test coverage detected