summaryrefslogtreecommitdiffstats
path: root/src/util.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.rs')
-rw-r--r--src/util.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/util.rs b/src/util.rs
index f838a9b..0979782 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -3,7 +3,7 @@
use std::cmp::Ordering;
/// A wrapper that converts a partial ordering into a total one by panicking.
-#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
+#[derive(Clone, Copy, Debug, PartialOrd)]
pub struct Ordered<T>(T);
impl<T> Ordered<T> {
@@ -25,7 +25,13 @@ impl<T: PartialOrd> Ord for Ordered<T> {
}
}
-impl<T: PartialEq> Eq for Ordered<T> {}
+impl<T: PartialOrd> PartialEq for Ordered<T> {
+ fn eq(&self, other: &Self) -> bool {
+ self.cmp(other) == Ordering::Equal
+ }
+}
+
+impl<T: PartialOrd> Eq for Ordered<T> {}
#[cfg(test)]
mod tests {