simple_url_parser

Crates.iosimple_url_parser
lib.rssimple_url_parser
version0.0.4
sourcesrc
created_at2021-08-18 13:54:50.125632
updated_at2023-07-24 11:42:56.693933
descriptionA simple parser for URL
homepage
repositoryhttps://github.com/Binbiubiubiu/simple_url_parser
max_upload_size
id438997
size9,604
(Binbiubiubiu)

documentation

https://docs.rs/simple_url_parser

README

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

nom

Commit count: 12

cargo fmt