🏗️ Elegant & Highly Performant Async Gemini Server Framework for the Modern Age
async framework gemini-protocol protocol gemini rust
at main 25 lines 560 B view raw
1//! Utilities to make cumbersome tasks simpler 2 3use std::collections::HashMap; 4 5/// Extract the queries from a URL into a `HashMap`. 6#[must_use] 7pub fn queries_from_url(url: &url::Url) -> HashMap<String, String> { 8 let mut queries = HashMap::new(); 9 10 for (key, value) in url.query_pairs() { 11 queries.insert(key.to_string(), value.to_string()); 12 } 13 14 queries 15} 16 17#[must_use] 18pub fn params_to_hashmap( 19 params: &matchit::Params<'_, '_>, 20) -> HashMap<String, String> { 21 params 22 .iter() 23 .map(|(k, v)| (k.to_string(), v.to_string())) 24 .collect() 25}