about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libcollections/bitv.rs9
-rw-r--r--src/libcollections/smallintmap.rs7
-rw-r--r--src/libcollections/trie.rs9
3 files changed, 23 insertions, 2 deletions
diff --git a/src/libcollections/bitv.rs b/src/libcollections/bitv.rs
index 55caf807b4f..3e1160b45ee 100644
--- a/src/libcollections/bitv.rs
+++ b/src/libcollections/bitv.rs
@@ -838,6 +838,13 @@ impl PartialOrd for Bitv {
     }
 }
 
+impl Ord for Bitv {
+    #[inline]
+    fn cmp(&self, other: &Bitv) -> Ordering {
+        iter::order::cmp(self.iter(), other.iter())
+    }
+}
+
 impl fmt::Show for Bitv {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
         for bit in self.iter() {
@@ -963,7 +970,7 @@ impl<'a> RandomAccessIterator<bool> for Bits<'a> {
 /// assert!(bv.eq_vec([true, true, false, true,
 ///                    false, false, false, false]));
 /// ```
-#[deriving(Clone, PartialEq, Eq, PartialOrd)]
+#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord)]
 pub struct BitvSet(Bitv);
 
 impl Default for BitvSet {
diff --git a/src/libcollections/smallintmap.rs b/src/libcollections/smallintmap.rs
index 5acabecb6ee..f567c5777b1 100644
--- a/src/libcollections/smallintmap.rs
+++ b/src/libcollections/smallintmap.rs
@@ -380,6 +380,13 @@ impl<V: PartialOrd> PartialOrd for SmallIntMap<V> {
     }
 }
 
+impl<V: Ord> Ord for SmallIntMap<V> {
+    #[inline]
+    fn cmp(&self, other: &SmallIntMap<V>) -> Ordering {
+        iter::order::cmp(self.iter(), other.iter())
+    }
+}
+
 impl<V: fmt::Show> fmt::Show for SmallIntMap<V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         try!(write!(f, "{{"));
diff --git a/src/libcollections/trie.rs b/src/libcollections/trie.rs
index 5d6a9080374..cd011b0e013 100644
--- a/src/libcollections/trie.rs
+++ b/src/libcollections/trie.rs
@@ -100,6 +100,13 @@ impl<T: PartialOrd> PartialOrd for TrieMap<T> {
     }
 }
 
+impl<T: Ord> Ord for TrieMap<T> {
+    #[inline]
+    fn cmp(&self, other: &TrieMap<T>) -> Ordering {
+        iter::order::cmp(self.iter(), other.iter())
+    }
+}
+
 impl<T: Show> Show for TrieMap<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         try!(write!(f, "{{"));
@@ -524,7 +531,7 @@ impl<S: Writer, T: Hash<S>> Hash<S> for TrieMap<T> {
 /// set.clear();
 /// assert!(set.is_empty());
 /// ```
-#[deriving(Clone, Hash, PartialEq, Eq, PartialOrd)]
+#[deriving(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
 pub struct TrieSet {
     map: TrieMap<()>
 }