6 releases

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

#1277 in Parser implementations

Download history 609/week @ 2024-03-14 920/week @ 2024-03-21 580/week @ 2024-03-28 779/week @ 2024-04-04 825/week @ 2024-04-11 752/week @ 2024-04-18 1260/week @ 2024-04-25 833/week @ 2024-05-02 649/week @ 2024-05-09 963/week @ 2024-05-16 966/week @ 2024-05-23 1368/week @ 2024-05-30 877/week @ 2024-06-06 891/week @ 2024-06-13 1199/week @ 2024-06-20 664/week @ 2024-06-27

3,894 downloads per month
Used in 46 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

~1.4–2.3MB
~71K SLoC