Struct veloren_common::astar::Astar
source · pub struct Astar<S, Hasher> {
iter: usize,
max_iters: usize,
max_cost: f32,
potential_nodes: BinaryHeap<PathEntry<S>>,
visited_nodes: HashMap<S, NodeEntry<S>, Hasher>,
closest_node: Option<(S, f32)>,
}
Fields§
§iter: usize
§max_iters: usize
§max_cost: f32
§potential_nodes: BinaryHeap<PathEntry<S>>
§visited_nodes: HashMap<S, NodeEntry<S>, Hasher>
§closest_node: Option<(S, f32)>
Node with the lowest heuristic value so far.
(node, heuristic value)
Implementations§
source§impl<S: Clone + Eq + Hash, H: BuildHasher + Clone> Astar<S, H>
impl<S: Clone + Eq + Hash, H: BuildHasher + Clone> Astar<S, H>
pub fn new(max_iters: usize, start: S, hasher: H) -> Self
pub fn with_max_cost(self, max_cost: f32) -> Self
pub fn poll<I>( &mut self, iters: usize, heuristic: impl FnMut(&S, &S) -> f32, neighbors: impl FnMut(&S) -> I, satisfied: impl FnMut(&S) -> bool, ) -> PathResult<S>
fn reconstruct_path_to(&mut self, end: S) -> Path<S>
Trait Implementations§
Auto Trait Implementations§
impl<S, Hasher> Freeze for Astar<S, Hasher>
impl<S, Hasher> RefUnwindSafe for Astar<S, Hasher>where
Hasher: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, Hasher> Send for Astar<S, Hasher>
impl<S, Hasher> Sync for Astar<S, Hasher>
impl<S, Hasher> Unpin for Astar<S, Hasher>
impl<S, Hasher> UnwindSafe for Astar<S, Hasher>where
Hasher: UnwindSafe,
S: UnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more