6 releases

0.0.6 Sep 30, 2020
0.0.5 Mar 5, 2020
0.0.4 Nov 11, 2019

#1650 in Parser implementations

Download history 553/week @ 2024-07-21 866/week @ 2024-07-28 991/week @ 2024-08-04 751/week @ 2024-08-11 798/week @ 2024-08-18 822/week @ 2024-08-25 809/week @ 2024-09-01 897/week @ 2024-09-08 1031/week @ 2024-09-15 1069/week @ 2024-09-22 712/week @ 2024-09-29 583/week @ 2024-10-06 707/week @ 2024-10-13 746/week @ 2024-10-20 969/week @ 2024-10-27 775/week @ 2024-11-03

3,217 downloads per month
Used in 47 crates (13 directly)

MIT/Apache

18KB
345 lines

Crates.io Crates.io

url2

Url2: Ergonomic wrapper around the popular url crate

Example

#[macro_use]
extern crate url2;

fn main() {
    let mut url = url2!("https://{}/", "example.com");
    url.query_unique()
        .set_pair("hello", "world")
        .set_pair("foo", "bar");

    assert!(url.query_unique_contains_key("hello"));
    assert_eq!("bar", url.query_unique_get("foo").unwrap());

    url.query_unique().remove("foo");

    assert_eq!(
        "https://example.com/?hello=world",
        url.as_str(),
    )
}

lib.rs:

Url2: Ergonomic wrapper around the popular url crate

Example

#[macro_use]
extern crate url2;

fn main() {
    let mut url = url2!("https://{}/", "example.com");
    url.query_unique()
        .set_pair("hello", "world")
        .set_pair("foo", "bar");

    assert!(url.query_unique_contains_key("hello"));
    assert_eq!("bar", url.query_unique_get("foo").unwrap());

    url.query_unique().remove("foo");

    assert_eq!(
        "https://example.com/?hello=world",
        url.as_str(),
    )
}

Dependencies

~2–3MB
~56K SLoC