blob: 92595e09458ebe6bf5e16862e0a3bf12546e0cc8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
/*
This file is part of jellything (https://codeberg.org/metamuffin/jellything)
which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
Copyright (C) 2024 metamuffin <metamuffin.org>
*/
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
}
}
|