aboutsummaryrefslogtreecommitdiff
path: root/common/src/helpers.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-08-07 13:46:22 +0200
committermetamuffin <metamuffin@disroot.org>2023-08-07 13:46:22 +0200
commita2e557e648cf253d47e9f4b9dd99ee657610f294 (patch)
tree350fe5868c9f7d890c79b2489b307c263ed7c307 /common/src/helpers.rs
parent908db5458b07d7a13f24c755d340ab3c1917e8a8 (diff)
downloadjellything-a2e557e648cf253d47e9f4b9dd99ee657610f294.tar
jellything-a2e557e648cf253d47e9f4b9dd99ee657610f294.tar.bz2
jellything-a2e557e648cf253d47e9f4b9dd99ee657610f294.tar.zst
extend sort and filter
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
+ }
+}