Provide naive implementations of cmp::Eq and to_bytes::IterBytes for net::url::Url

This commit is contained in:
Brian J. Burg 2012-09-10 14:07:25 -07:00
parent a07ea73bdb
commit 10a7865428

View file

@ -9,6 +9,7 @@ use dvec::DVec;
use from_str::FromStr;
use result::{Err, Ok};
use to_str::ToStr;
use to_bytes::IterBytes;
export Url, Query;
export from_str, to_str;
@ -718,6 +719,28 @@ impl Url: to_str::ToStr {
}
}
impl Url: Eq {
pure fn eq(&&other: Url) -> bool {
self.scheme == other.scheme
&& self.user == other.user
&& self.host == other.host
&& self.port == other.port
&& self.path == other.path
&& self.query == other.query
&& self.fragment == other.fragment
}
pure fn ne(&&other: Url) -> bool {
!self.eq(other)
}
}
impl Url: IterBytes {
fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
self.to_str().iter_bytes(lsb0, f)
}
}
#[cfg(test)]
mod tests {
#[test]