1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! The distance metric used to compare vectors.
/// The metric used to measure distance (or similarity) between two vectors.
///
/// Which metric is valid depends on how the vectors were produced — cosine and
/// dot product suit normalized embeddings, the geometric metrics suit raw
/// coordinates, and Hamming suits binary codes. The engine selects the matching
/// comparison from this tag.
///
/// # Examples
///
/// ```
/// use iqdb_types::DistanceMetric;
///
/// let metric = DistanceMetric::Cosine;
/// assert_eq!(metric, DistanceMetric::Cosine);
/// assert_ne!(metric, DistanceMetric::Euclidean);
/// ```
///
/// The enum is `#[non_exhaustive]`: future releases may add metrics (for
/// example, Jaccard or Chebyshev) without it being a breaking change, so a
/// `match` on it from another crate must include a wildcard arm.