On 01/08/14 00:08, Daniel Fath wrote:
Is rust-url compatible with rust-uri? And if not are there any plans to
support URI specification with it?
Is there a project called rust-uri? I can’t find it.
rust-url supports URIs because they’re really the same thing as URLs. It
implements the URL standard, which uses the term for both:
http://url.spec.whatwg.org/#goals :
* Standardize on the term URL. URI and IRI are just confusing. In
practice a single algorithm is used for both so keeping them distinct
is not helping anyone.
For example:
```
extern crate url;
use url::Url;
let isbn_url = Url::parse("urn:isbn:0-486-27557-4#chapter6").unwrap();
assert(isbn_url.scheme == "urn".to_sting());
assert(isbn_url.non_relative_scheme_data()
== Some("isbn:0-486-27557-4"));
assert(isbn_url.query == None);
assert(isbn_url.fragment == Some("chapter6".to_sting()));
```
The only interesting thing here is that "urn" is a "non-relative"
scheme: Other than the scheme, query string, and fragment identifier,
URLs in that scheme (as in data, mailto, and others) only have a "scheme
data" string.
For URLs in a "relative" scheme like http, instead of a single string
the scheme data is a username, password, host, port number, and path.
(Some of which are optional or can be empty.)
--
Simon Sapin
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev