Crates.io | urlparse |
lib.rs | urlparse |
version | 0.7.3 |
source | src |
created_at | 2015-12-24 04:43:27.498773 |
updated_at | 2016-02-13 13:00:18.133283 |
description | This is a URL parsing library like urllib.parse in Python3.x. |
homepage | |
repository | https://github.com/yykamei/rust-urlparse |
max_upload_size | |
id | 3737 |
size | 38,713 |
This is a URL parsing library written in Rust.
The goal of this project is to provide a simple parsing URL library like urllib.parse in Python3.x.
extern crate urlparse;
use urlparse::urlparse;
use urlparse::GetQuery; // Trait
fn main() {
let url = urlparse("http://www.example.com/foo?bar=123&col=println%21%28%22TEST%21%22%29&col=sub");
let query = url.get_parsed_query().unwrap();
println!("{:?}", url);
println!("{:?}", query.get_first_from_str("col"));
}
Url { scheme: "http", netloc: "www.example.com", path: "/foo", query: Some("bar=123&col=println%21%28%22TEST%21%22%29&col=sub"), fragment: None, username: None, password: None, hostname: Some("www.example.com"), port: None }
Some("println!(\"TEST!\")")
MIT
If you're using Cargo, just add urlparse to your Cargo.toml:
[dependencies.urlparse]
version = "0.7.2"
The documentation is hosted online.