#url #parser

url2

ergonomic wrapper around the popular url crate

6 releases

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

#108 in Parser implementations

Download history 243/week @ 2021-01-12 288/week @ 2021-01-19 353/week @ 2021-01-26 188/week @ 2021-02-02 234/week @ 2021-02-09 317/week @ 2021-02-16 205/week @ 2021-02-23 254/week @ 2021-03-02 321/week @ 2021-03-09 331/week @ 2021-03-16 331/week @ 2021-03-23 403/week @ 2021-03-30 231/week @ 2021-04-06 275/week @ 2021-04-13 306/week @ 2021-04-20 286/week @ 2021-04-27

1,053 downloads per month
Used in 7 crates (3 directly)

MIT/Apache

17KB
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.9–2.7MB
~77K SLoC