Created
December 24, 2017 02:40
-
-
Save hatoo/4e56d5e69d7a9e64be0a5b8ea3743564 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(PartialEq, PartialOrd)] | |
struct Total<T>(pub T); | |
impl<T: PartialEq> Eq for Total<T> {} | |
impl<T: PartialOrd> Ord for Total<T> { | |
fn cmp(&self, other: &Total<T>) -> Ordering { | |
self.0.partial_cmp(&other.0).unwrap() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment