diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2021-02-25 11:24:42 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2021-02-25 11:24:42 -0500 |
commit | 15ec99c64f65da7966b4282ff94fee0a611c23df (patch) | |
tree | 9d810c6e5e3e8e1ead73e87c237e30823a588e52 /src/util.rs | |
parent | 87a9da4e3ff0e54927ed20120db8b0317f7c272e (diff) | |
download | acap-15ec99c64f65da7966b4282ff94fee0a611c23df.tar.xz |
knn: Move NearestNeighbor interfaces to a submodule
Diffstat (limited to 'src/util.rs')
-rw-r--r-- | src/util.rs | 10 |
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 { |