diff options
| author | bors <bors@rust-lang.org> | 2014-07-11 01:11:36 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-07-11 01:11:36 +0000 |
| commit | b57d272e9908e164a72bd1a688141031705e1208 (patch) | |
| tree | 78f0c85ad6438fe5daf13cf3c344f58f222d3e6f /src/libstd/path | |
| parent | 0e80dbe59ea986ea53cc3caabffd40b2eaee4dc6 (diff) | |
| parent | 8aa8ca7991412b6d326b131e17177b8610239841 (diff) | |
| download | rust-b57d272e9908e164a72bd1a688141031705e1208.tar.gz rust-b57d272e9908e164a72bd1a688141031705e1208.zip | |
auto merge of #15564 : alexcrichton/rust/moar-hash, r=huonw
- semver::Version is now Eq, Ord, and Hash - Path is now PartialOrd and Ord
Diffstat (limited to 'src/libstd/path')
| -rw-r--r-- | src/libstd/path/posix.rs | 14 | ||||
| -rw-r--r-- | src/libstd/path/windows.rs | 14 |
2 files changed, 26 insertions, 2 deletions
diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index 5c6e140bd29..007686aa05c 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -12,7 +12,7 @@ use c_str::{CString, ToCStr}; use clone::Clone; -use cmp::{PartialEq, Eq}; +use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering}; use collections::Collection; use from_str::FromStr; use hash; @@ -68,6 +68,18 @@ impl PartialEq for Path { impl Eq for Path {} +impl PartialOrd for Path { + fn partial_cmp(&self, other: &Path) -> Option<Ordering> { + Some(self.cmp(other)) + } +} + +impl Ord for Path { + fn cmp(&self, other: &Path) -> Ordering { + self.repr.cmp(&other.repr) + } +} + impl FromStr for Path { fn from_str(s: &str) -> Option<Path> { Path::new_opt(s) diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 5e42d740e03..88ae0d4837e 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -13,7 +13,7 @@ use ascii::AsciiCast; use c_str::{CString, ToCStr}; use clone::Clone; -use cmp::{PartialEq, Eq}; +use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering}; use collections::Collection; use from_str::FromStr; use hash; @@ -90,6 +90,18 @@ impl PartialEq for Path { impl Eq for Path {} +impl PartialOrd for Path { + fn partial_cmp(&self, other: &Path) -> Option<Ordering> { + Some(self.cmp(other)) + } +} + +impl Ord for Path { + fn cmp(&self, other: &Path) -> Ordering { + self.repr.cmp(&other.repr) + } +} + impl FromStr for Path { fn from_str(s: &str) -> Option<Path> { Path::new_opt(s) |
