pub trait CodecDistance {
// Required method
fn distance(&self, a: NodeId, b: NodeId) -> f32;
}Expand description
Distance abstraction that every dynvec ANN container
honours.
The trait is intentionally narrow: a single
(NodeId, NodeId) -> f32 score is enough to drive the HNSW
pruning heuristics (select_neighbours and
shrink_connections). Query-to-node scoring during search
is handled by each impl directly because the query’s f32
representation is in scope at that layer. Smaller scores
mean closer.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".