diff options
| author | Brian J. Burg <burg@cs.washington.edu> | 2012-09-10 14:07:25 -0700 |
|---|---|---|
| committer | Brian J. Burg <burg@cs.washington.edu> | 2012-09-10 14:20:39 -0700 |
| commit | 10a7865428c03613fa510951f22e00a024a472f6 (patch) | |
| tree | 41568821874010e17d2554013c5c7c87a79ca15f /src/libstd | |
| parent | a07ea73bdbc023f80efe809388ed9299ba76bcb8 (diff) | |
| download | rust-10a7865428c03613fa510951f22e00a024a472f6.tar.gz rust-10a7865428c03613fa510951f22e00a024a472f6.zip | |
Provide naive implementations of cmp::Eq and to_bytes::IterBytes for net::url::Url
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/net_url.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/libstd/net_url.rs b/src/libstd/net_url.rs index a0eab69fb35..cef29bbef2a 100644 --- a/src/libstd/net_url.rs +++ b/src/libstd/net_url.rs @@ -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] |
