Trait vpsearch::MetricSpace [] [src]

pub trait MetricSpace {
    type UserData;
    type Distance: Copy + PartialOrd + Bounded + Add<Output=Self::Distance>;
    fn distance(&self,
                other: &Self,
                user_data: &Self::UserData)
                -> Self::Distance; }

Elements you're searching for must be comparable using this trait

Associated Types

This is used as a context for comparisons. Use () if the elements already contain all the data you need.

This is a fancy way of saying it should be f32 or u32

Required Methods

This function must return distance between two items that meets triangle inequality. Specifically, it can't return squared distance (you must use sqrt if you use Euclidean distance)

@param user_data Whatever you want. Passed from new_with_user_data_*()

Implementors