From 3bce7f969d31b15244b60a70d27af27d95a03594 Mon Sep 17 00:00:00 2001 From: Mikolaj Wielgus Date: Mon, 12 May 2025 23:30:43 +0200 Subject: [PATCH] refactor(router/astar): Have separate statuses for discarded probes and skipped visits This is mostly to improve readability. Since we don't check the values of the continue statuses anywhere anyway, this doesn't result in any changes to code outside of the router/astar module. --- src/router/astar.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/router/astar.rs b/src/router/astar.rs index 7246d9c..9c1db05 100644 --- a/src/router/astar.rs +++ b/src/router/astar.rs @@ -139,7 +139,9 @@ where #[derive(Debug)] pub enum AstarContinueStatus { Probing, + ProbingButDiscarded, Probed, + VisitSkipped, Visited, } @@ -211,7 +213,9 @@ where // No need to add neighbors that we have already reached through a // shorter path than now. if *entry.get() <= next_score { - return Ok(ControlFlow::Continue(AstarContinueStatus::Probed)); + return Ok(ControlFlow::Continue( + AstarContinueStatus::ProbingButDiscarded, + )); } entry.insert(next_score); } @@ -250,7 +254,7 @@ where // If the node has already been visited with an equal or lower score than // now, then we do not need to re-visit it. if *entry.get() <= estimate_score { - return Ok(ControlFlow::Continue(AstarContinueStatus::Visited)); + return Ok(ControlFlow::Continue(AstarContinueStatus::VisitSkipped)); } entry.insert(estimate_score); }