Crate url2

Source
Expand description

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(),
    )
}

Modules§

prelude
Everything you need to work with the Url2 library.

Macros§

try_url2
works like the format!() macro, but passes the result through Url2::try_parse()
url2
works like the format!() macro, but passes the result through Url2::parse()

Structs§

Url2
Ergonomic wrapper around the popular Url crate
Url2Error
Represents a Url2 Error
Url2QueryUnique
Gives access to the query string restricting the view to unique keys.

Enums§

Url2ErrorKind
enum representing the type of Url2Error

Type Aliases§

Url2Result
Url2 Result Type