We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d3079a1 commit ce49c24Copy full SHA for ce49c24
pkg.rs
@@ -20,7 +20,7 @@ use std::option::{Option};
20
use std::os;
21
use std::str;
22
23
-#[deriving(PartialEq)]
+#[deriving(Eq, PartialEq)]
24
struct Version {
25
major: uint,
26
minor: uint
@@ -43,8 +43,14 @@ impl std::fmt::Show for Version {
43
}
44
45
impl PartialOrd for Version {
46
- fn lt(&self, other: &Version) -> bool {
47
- self.major < other.major || (self.major == other.major && self.minor < other.minor)
+ fn partial_cmp(&self, other: &Version) -> Option<Ordering> {
+ Some(self.cmp(other))
48
+ }
49
+}
50
+
51
+impl Ord for Version {
52
+ fn cmp(&self, other: &Version) -> Ordering {
53
+ (self.major, self.minor).cmp(&(other.major, other.minor))
54
55
56
0 commit comments