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

Method metadata

crates/css_ast/src/properties/mod.rs:103–158  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

101
102impl<'a> NodeWithMetadata<CssMetadata> for StyleValue<'a> {
103 fn metadata(&self) -> CssMetadata {
104 macro_rules! metadata {
105 ( $( $name: ident: $ty: ident$(<$a: lifetime>)? = $str: tt,)+ ) => {
106 match self {
107 Self::Initial(_) |
108 Self::Inherit(_)|
109 Self::Unset(_)|
110 Self::Revert(_)|
111 Self::RevertLayer(_) => {
112 CssMetadata {
113 declaration_kinds: DeclarationKind::CssWideKeywords,
114 ..Default::default()
115 }
116 }
117 Self::Custom(_) => {
118 CssMetadata {
119 declaration_kinds: DeclarationKind::Custom,
120 ..Default::default()
121 }
122 }
123 Self::Computed(_) => {
124 CssMetadata {
125 declaration_kinds: DeclarationKind::Computed,
126 ..Default::default()
127 }
128 },
129 Self::Unknown(_) => {
130 CssMetadata {
131 node_kinds: NodeKinds::Unknown,
132 ..Default::default()
133 }
134 },
135 $(
136 Self::$name(_) => {
137 let mut declaration_kinds = DeclarationKind::none();
138 if values::$ty::is_shorthand() {
139 declaration_kinds |= DeclarationKind::Shorthands;
140 } else {
141 declaration_kinds |= DeclarationKind::Longhands;
142 }
143 CssMetadata {
144 property_groups: values::$ty::property_group(),
145 applies_to: values::$ty::applies_to(),
146 box_sides: values::$ty::box_side(),
147 box_portions: values::$ty::box_portion(),
148 declaration_kinds,
149 unitless_zero_resolves: values::$ty::unitless_zero_resolves(),
150 ..Default::default()
151 }
152 }
153 )+
154 }
155 };
156 }
157 apply_properties!(metadata)
158 }
159}
160

Callers 1

declaration_metadataMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected