4 releases
0.0.4 | Jul 24, 2023 |
---|---|
0.0.3 | Aug 18, 2021 |
0.0.2 | Aug 18, 2021 |
0.0.1 | Aug 18, 2021 |
#2452 in Parser implementations
7KB
90 lines
simple_url_parser
a simple parser for URL
fn main(){
let mock_url = "https://lb:123456@www.google.com:123/blog/01?a=1&b=2#132456";
let url_obj = URL::parse(mock_url).unwrap();
assert_eq!(url_obj.scheme, "https:");
assert_eq!(url_obj.username, "lb");
assert_eq!(url_obj.password, "123456");
assert_eq!(url_obj.host, "www.google.com");
assert_eq!(url_obj.port, "123");
assert_eq!(url_obj.path, "/blog/01");
assert_eq!(url_obj.query, "?a=1&b=2");
assert_eq!(url_obj.hash, "#132456");
let url_str = URL::stringify(&url_obj);
assert_eq!(url_str, mock_url);
}
Thanks
lib.rs
:
simple_url_parser
a simple parser for URL
fn main(){
let mock_url = "https://lb:123456@www.google.com:123/blog/01?a=1&b=2#132456";
let url_obj = URL::parse(mock_url).unwrap();
assert_eq!(url_obj.scheme, "https:");
assert_eq!(url_obj.username, "lb");
assert_eq!(url_obj.password, "123456");
assert_eq!(url_obj.host, "www.google.com");
assert_eq!(url_obj.port, "123");
assert_eq!(url_obj.path, "/blog/01");
assert_eq!(url_obj.query, "?a=1&b=2");
assert_eq!(url_obj.hash, "#132456");
let url_str = URL::stringify(&url_obj);
assert_eq!(url_str, mock_url);
}
Thanks
Dependencies
~1MB
~19K SLoC