Make Search::reset() more robust to future changes

This commit is contained in:
Dirkjan Ochtman 2020-12-16 12:39:28 +01:00
parent 098a4e4ef6
commit 1871b61b08
1 changed files with 12 additions and 4 deletions

View File

@ -217,10 +217,18 @@ pub struct Search {
impl Search {
/// Resets the state to be ready for a new search
fn reset(&mut self) {
self.visited.clear();
self.candidates.clear();
self.nearest.clear();
self.furthest = OrderedFloat::from(f32::INFINITY);
let Search {
visited,
candidates,
nearest,
num: _,
furthest,
} = self;
visited.clear();
candidates.clear();
nearest.clear();
*furthest = OrderedFloat::from(f32::INFINITY);
}
/// Track node `pid` as a potential new neighbor for the given `point`