The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

Get Querystring Params From A URL In Rust

TODO: Pull subtitle into page object
Code
use url::Url;

fn main() {
    let url = Url::parse("https://www.example.com/index.html?alfa=bravo&charlie=delta")
        .expect("Could not parse url");
    let query_pairs = url.query_pairs();
    query_pairs.for_each(|param| {
        println!("key: {}, value: {}", param.0, param.1);
        ()
    });
}

This uses the url create (which has 104 million downloads)

Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

Get Querystring Params From A URL In Rust

This is what I'm doing to get query params in Rust:

-- code
-- rust

use url::Url;

fn main() {
    let url = Url::parse("https://www.example.com/index.html?alfa=bravo&charlie=delta")
        .expect("Could not parse url");
    let query_pairs = url.query_pairs();
    query_pairs.for_each(|param| {
        println!("key: {}, value: {}", param.0, param.1);
        ()
    });
}

-- note

This uses the <<link|url create|https://docs.rs/url/2.4.0/url/>>
(which has 104 million downloads)


-- categories
-- WebDev 

-- metadata
-- date: 2023-06-15 16:46:19
-- id: 2rg2doht
-- site: aws
-- type: rust 
-- status: published