6 releases
0.0.6 | Sep 30, 2020 |
---|---|
0.0.5 | Mar 5, 2020 |
0.0.4 | Nov 11, 2019 |
#1650 in Parser implementations
3,217 downloads per month
Used in 47 crates
(13 directly)
18KB
345 lines
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