Crates.io | simple_url_parser |
lib.rs | simple_url_parser |
version | 0.0.4 |
source | src |
created_at | 2021-08-18 13:54:50.125632 |
updated_at | 2023-07-24 11:42:56.693933 |
description | A simple parser for URL |
homepage | |
repository | https://github.com/Binbiubiubiu/simple_url_parser |
max_upload_size | |
id | 438997 |
size | 9,604 |
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);
}