pub trait ScoreSink {
// Required methods
fn offer(&mut self, id: RecordId, score: f32);
fn threshold(&self) -> Option<f32>;
fn into_results(self) -> Vec<(RecordId, f32)>;
}Expand description
Consumer of (id, score) pairs produced by the search loop.
The loop offers records in increasing id order and asks for the
threshold before scoring a window: a record whose
score cannot strictly exceed it is not worth scoring. Because later
records have larger ids and ties go to the lower id, a score equal to the
threshold can never displace what the sink already holds.
Required Methods§
Sourcefn threshold(&self) -> Option<f32>
fn threshold(&self) -> Option<f32>
Score a new record must strictly beat to be retained, or None if
every record is still welcome.
Sourcefn into_results(self) -> Vec<(RecordId, f32)>
fn into_results(self) -> Vec<(RecordId, f32)>
Retained records, sorted by score descending then id ascending.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".