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

Function browser_version_tokens

crates/csskit_spec_generator/src/codegen.rs:1074–1089  ·  view source on GitHub ↗
(version: Option<&str>)

Source from the content-addressed store, hash-verified

1072}
1073
1074fn browser_version_tokens(version: Option<&str>) -> TokenStream {
1075 if let Some(ver) = version {
1076 if ver.is_empty() {
1077 return quote! { BrowserVersion(0, 0) };
1078 }
1079
1080 if ver.chars().all(|c| c.is_ascii_digit() || c == '.') {
1081 let parts: Vec<&str> = ver.split('.').collect();
1082 let major: u16 = parts.first().and_then(|s| s.parse().ok()).unwrap_or(0);
1083 let minor: u16 = parts.get(1).and_then(|s| s.parse().ok()).unwrap_or(0);
1084 return quote! { BrowserVersion(#major, #minor) };
1085 }
1086 }
1087
1088 quote! { BrowserVersion(0, 0) }
1089}
1090
1091pub fn generate_property_atoms(property_names: &std::collections::HashSet<String>) -> String {
1092 use heck::ToKebabCase;

Callers 1

Calls 5

collectMethod · 0.80
okMethod · 0.80
is_emptyMethod · 0.45
parseMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected