Heuristic

Trait Heuristic 

Source
pub trait Heuristic: Clone {
    type Iter: Iterator<Item = bool>;

    // Required methods
    fn enter(&mut self, side: bool);
    fn iter(&self) -> Self::Iter;
}
Expand description

The Heuristic chooses which side to explore next.

This is not useful for finding perfect nearest neighbors because it can take a path first that eliminates another better match in another branch. This will work well to find things of a particular distance, which is useful for discrete nearest neighbor searches in a given radius. It is also useful to find all things within a given radius, but the outputs will only be approximately ordered with respect to distance.

This is cloned right before entering a side, so it is expected that enter updates the state of the Heuristic.

Required Associated Types§

Source

type Iter: Iterator<Item = bool>

Required Methods§

Source

fn enter(&mut self, side: bool)

This is passed the side.

Source

fn iter(&self) -> Self::Iter

Must return an iterator which returns values below 16, otherwise panics.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<F> Heuristic for FilterHeuristic<F>
where F: FnMut(bool) -> bool + Clone,

Source§

type Iter = FilterHeuristicIter<F>

Source§

impl<F> Heuristic for SearchHeuristic<F>
where F: FnMut(bool) -> bool + Clone,

Source§

type Iter = Cloned<Iter<'static, bool>>