pub struct SearchProgress {
pub status: SearchStatus,
pub work: u32,
}Fields§
§status: SearchStatus§work: u32Work consumed by this call, including path reconstruction.
Implementations§
Source§impl SearchProgress
impl SearchProgress
Sourcepub fn budget_exhausted(&self) -> bool
pub fn budget_exhausted(&self) -> bool
Whether a running search yielded because its work allowance ran out.
This includes a zero allowance while searching or tracing. A terminal
outcome such as SearchStatus::NoPath takes precedence even when the
call consumed the exact allowance. An idle planner with queued requests
has not started a search and returns false.
use ferravex_play::navigation::{Cell, Connectivity, Grid, SearchScratch, SearchStatus};
let mut grid = Grid::new(3, 1).unwrap();
let mut search = SearchScratch::new(3).unwrap();
search.begin(&grid, Cell { x: 0, y: 0 }, Cell { x: 2, y: 0 }, Connectivity::Four).unwrap();
assert!(search.step(&grid, 1).budget_exhausted());
assert_eq!(search.step(&grid, 5).status, SearchStatus::Found);
grid.set_blocked(Cell { x: 1, y: 0 }, true).unwrap();
search.restart(&grid).unwrap();
let progress = search.step(&grid, 1);
assert_eq!(progress.status, SearchStatus::NoPath);
assert!(!progress.budget_exhausted());Trait Implementations§
Source§impl Clone for SearchProgress
impl Clone for SearchProgress
Source§fn clone(&self) -> SearchProgress
fn clone(&self) -> SearchProgress
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SearchProgress
impl Debug for SearchProgress
impl Copy for SearchProgress
Auto Trait Implementations§
impl Freeze for SearchProgress
impl RefUnwindSafe for SearchProgress
impl Send for SearchProgress
impl Sync for SearchProgress
impl Unpin for SearchProgress
impl UnwindSafe for SearchProgress
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more