Add Search::get() helper for bindings

This commit is contained in:
Dirkjan Ochtman 2021-03-17 16:44:16 +01:00
parent 1950ca2b3b
commit 17ec0c9184
1 changed files with 5 additions and 0 deletions

View File

@ -673,6 +673,11 @@ impl Search {
fn iter(&self) -> impl Iterator<Item = PointId> + ExactSizeIterator + '_ { fn iter(&self) -> impl Iterator<Item = PointId> + ExactSizeIterator + '_ {
self.nearest.iter().map(|candidate| candidate.pid) self.nearest.iter().map(|candidate| candidate.pid)
} }
#[doc(hidden)]
pub fn get(&self, i: usize) -> Option<PointId> {
self.nearest.get(i).map(|candidate| candidate.pid)
}
} }
impl Default for Search { impl Default for Search {