Fetches CSS popularity data from chromestatus.com Returns a map of property names to their usage percentage (0-100)
(client: &Client)
| 169 | /// |
| 170 | /// Returns a map of property names to their usage percentage (0-100) |
| 171 | pub 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 | } |
no test coverage detected