Skip to content

Commit

Permalink
Remove the Debug and Default bounds on the Distance type
Browse files Browse the repository at this point in the history
  • Loading branch information
Gijsvs committed Oct 15, 2020
1 parent 5b11a68 commit 59d388a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion examples/knn.rs
@@ -1,6 +1,7 @@
use vpsearch::{BestCandidate, MetricSpace};

use std::collections::HashSet;
use num_traits::Bounded;

#[derive(Clone, Debug)]
struct PointN {
Expand Down Expand Up @@ -45,7 +46,7 @@ impl<Item: MetricSpace<Impl>, Impl> CountBasedNeighborhood<Item, Impl> {
fn new(item_count: usize) -> Self {
CountBasedNeighborhood {
max_item_count: item_count,
max_observed_distance: <Item::Distance as Default>::default(),
max_observed_distance: <Item::Distance as Bounded>::min_value(),
distance_x_index: Vec::<(Item::Distance, usize)>::new(),
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/lib.rs
Expand Up @@ -62,7 +62,6 @@

use std::cmp::Ordering;
use std::ops::Add;
use std::fmt::Debug;
use std::marker::Sized;
use num_traits::Bounded;

Expand Down Expand Up @@ -90,7 +89,7 @@ pub trait MetricSpace<UserImplementationType = ()> {
type UserData;

/// This is a fancy way of saying it should be `f32` or `u32`
type Distance: Copy + PartialOrd + Bounded + Default + Debug + Add<Output = Self::Distance>;
type Distance: Copy + PartialOrd + Bounded + Add<Output = Self::Distance>;

/**
* This function must return distance between two items that meets triangle inequality.
Expand Down

0 comments on commit 59d388a

Please sign in to comment.