mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-30 21:16:27 +03:00
Provide naive implementations of cmp::Eq and to_bytes::IterBytes for net::url::Url
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
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 @@ fn to_str() -> ~str {
|
||||
}
|
||||
}
|
||||
|
||||
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]
|
||||
|
||||
Reference in New Issue
Block a user