use std::cmp::Ordering;
#[derive(Debug, Copy, Clone)]
pub struct QueryResultItem<P, T, D> {
pub point: P,
pub item: T,
pub distance: D,
}
impl<P, T, D: PartialOrd> Ord for QueryResultItem<P, T, D> {
fn cmp(&self, other: &Self) -> Ordering {
self.partial_cmp(other).unwrap_or(Ordering::Equal)
}
}
#[allow(renamed_and_removed_lints)]
#[allow(unknown_lints)]
#[allow(clippy::incorrect_partial_ord_impl_on_ord_type)]
#[allow(clippy::non_canonical_partial_ord_impl)]
impl<P, T, D: PartialOrd> PartialOrd for QueryResultItem<P, T, D> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
self.distance.partial_cmp(&other.distance)
}
}
impl<P, T, D: PartialEq> Eq for QueryResultItem<P, T, D> {}
impl<P, T, D: PartialEq> PartialEq for QueryResultItem<P, T, D> {
fn eq(&self, other: &Self) -> bool {
self.distance == other.distance
}
}