oni-comb-uri-rs

A Rust crate for URI.

Specification

This crate is based on the following specifications.

Usage

```rust use onicomburi::uri::Uri;

let s = "http://user1:pass1@localhost:8080/example?key1=value1&key2=value2&key1=value2#f1";

match Uri::parse(s) { Ok(uri) => { uri.schema().intoiter().foreach(|s| asserteq!(s.tostring(), "http")); uri .hostname() .intoiter() .foreach(|hn| asserteq!(hn.tostring(), "localhost")); uri.port().intoiter().foreach(|p| asserteq!(p, 8080)); uri.userinfo().intoiter().foreach(|ui| { asserteq!(ui.username(), "user1"); asserteq!(ui.password(), Some("pass1")); }); uri .path() .intoiter() .foreach(|p| asserteq!(p.tostring(), "/example")); uri.query().intoiter().foreach(|q| { q.getparam("key1".tostring()).intoiter().foreach(|v| { asserteq!(v.len(), 2); asserteq!(v[0], "value1"); asserteq!(v[1], "value2"); }); q.getparam("key2".tostring()).intoiter().foreach(|v| { asserteq!(v.len(), 1); asserteq!(v[0], "value2"); }); }); uri.fragment().intoiter().foreach(|f| asserteq!(f, "f1")); println!("{:?}", uri); } Err(e) => println!("{:?}", e), } ```