Add Hnsw::iter() method

This commit is contained in:
Dirkjan Ochtman 2020-12-16 11:46:50 +01:00
parent 68b5c72067
commit fbfefdba6f
1 changed files with 8 additions and 0 deletions

View File

@ -187,6 +187,14 @@ where
}
found
}
/// Iterate over the keys and values in this index
pub fn iter(&self) -> impl Iterator<Item = (PointId, &P)> {
self.points
.iter()
.enumerate()
.map(|(i, p)| (PointId(i as u32), p))
}
}
/// Keeps mutable state for searching a point's nearest neighbors