From 15ec99c64f65da7966b4282ff94fee0a611c23df Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 25 Feb 2021 11:24:42 -0500 Subject: knn: Move NearestNeighbor interfaces to a submodule --- src/util.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/util.rs') 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); impl Ordered { @@ -25,7 +25,13 @@ impl Ord for Ordered { } } -impl Eq for Ordered {} +impl PartialEq for Ordered { + fn eq(&self, other: &Self) -> bool { + self.cmp(other) == Ordering::Equal + } +} + +impl Eq for Ordered {} #[cfg(test)] mod tests { -- cgit v1.2.3