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

Function get_css_popularity

crates/csskit_spec_generator/src/fetch_cached.rs:171–184  ·  view source on GitHub ↗

Fetches CSS popularity data from chromestatus.com Returns a map of property names to their usage percentage (0-100)

(client: &Client)

Source from the content-addressed store, hash-verified

169///
170/// Returns a map of property names to their usage percentage (0-100)
171pub async fn get_css_popularity(client: &Client) -> Result<HashMap<String, f64>> {
172 let cache_key = "popularity.json";
173 let url = "https://chromestatus.com/data/csspopularity";
174
175 let text = fetch_cached(client, url, cache_key).await?;
176 let data: Vec<PopularityEntry> = serde_json::from_str(&text)?;
177
178 let mut popularity_map = HashMap::new();
179 for entry in data {
180 popularity_map.insert(entry.property_name, entry.day_percentage * 100.0);
181 }
182
183 Ok(popularity_map)
184}

Callers 1

mainFunction · 0.85

Calls 2

fetch_cachedFunction · 0.85
insertMethod · 0.45

Tested by

no test coverage detected