aboutsummaryrefslogtreecommitdiff
path: root/common/src/helpers.rs
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/helpers.rs')
-rw-r--r--common/src/helpers.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/common/src/helpers.rs b/common/src/helpers.rs
new file mode 100644
index 0000000..5150667
--- /dev/null
+++ b/common/src/helpers.rs
@@ -0,0 +1,20 @@
+use std::ops::Deref;
+
+#[derive(PartialEq, PartialOrd)]
+pub struct SortAnyway<T>(pub T);
+
+impl<T: PartialEq> Eq for SortAnyway<T> {
+ fn assert_receiver_is_total_eq(&self) {}
+}
+impl<T: PartialOrd> Ord for SortAnyway<T> {
+ fn cmp(&self, other: &Self) -> std::cmp::Ordering {
+ self.partial_cmp(&other).unwrap()
+ }
+}
+
+impl<T> Deref for SortAnyway<T> {
+ type Target = T;
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}