|
|
@@ -124,7 +124,6 @@ extern crate rustc_serialize;
|
|
|
extern crate matches;
|
|
|
|
|
|
use std::fmt::{self, Formatter};
|
|
|
-use std::hash;
|
|
|
use std::str;
|
|
|
use std::path::{Path, PathBuf};
|
|
|
|
|
|
@@ -150,7 +149,7 @@ mod tests;
|
|
|
|
|
|
|
|
|
/// The parsed representation of an absolute URL.
|
|
|
-#[derive(PartialEq, Eq, Clone, Debug)]
|
|
|
+#[derive(PartialEq, Eq, Clone, Debug, Hash)]
|
|
|
pub struct Url {
|
|
|
/// The scheme (a.k.a. protocol) of the URL, in ASCII lower case.
|
|
|
pub scheme: String,
|
|
|
@@ -181,7 +180,7 @@ pub struct Url {
|
|
|
}
|
|
|
|
|
|
/// The components of the URL whose representation depends on where the scheme is *relative*.
|
|
|
-#[derive(PartialEq, Eq, Clone, Debug)]
|
|
|
+#[derive(PartialEq, Eq, Clone, Debug, Hash)]
|
|
|
pub enum SchemeData {
|
|
|
/// Components for URLs in a *relative* scheme such as HTTP.
|
|
|
Relative(RelativeSchemeData),
|
|
|
@@ -195,7 +194,7 @@ pub enum SchemeData {
|
|
|
}
|
|
|
|
|
|
/// Components for URLs in a *relative* scheme such as HTTP.
|
|
|
-#[derive(PartialEq, Eq, Clone, Debug)]
|
|
|
+#[derive(PartialEq, Eq, Clone, Debug, Hash)]
|
|
|
pub struct RelativeSchemeData {
|
|
|
/// The username of the URL, as a possibly empty, percent-encoded string.
|
|
|
///
|
|
|
@@ -234,11 +233,6 @@ pub struct RelativeSchemeData {
|
|
|
pub path: Vec<String>,
|
|
|
}
|
|
|
|
|
|
-impl hash::Hash for Url {
|
|
|
- fn hash<H: hash::Hasher>(&self, state: &mut H) {
|
|
|
- self.serialize().hash(state)
|
|
|
- }
|
|
|
-}
|
|
|
|
|
|
impl str::FromStr for Url {
|
|
|
type Err = ParseError;
|
|
|
@@ -405,7 +399,7 @@ impl<'a> UrlParser<'a> {
|
|
|
|
|
|
|
|
|
/// Determines the behavior of the URL parser for a given scheme.
|
|
|
-#[derive(PartialEq, Eq, Copy, Debug, Clone)]
|
|
|
+#[derive(PartialEq, Eq, Copy, Debug, Clone, Hash)]
|
|
|
pub enum SchemeType {
|
|
|
/// Indicate that the scheme is *non-relative*.
|
|
|
///
|