pub trait GraphOracle {
// Required methods
fn neighbours(&mut self, state: GcRef) -> Result<Vec<GcRef>, Aborted>;
fn weight(&mut self, from: GcRef, to: GcRef) -> Result<i64, Aborted>;
fn heuristic(&mut self, state: GcRef) -> Result<i64, Aborted>;
fn is_goal(&mut self, state: GcRef) -> Result<bool, Aborted>;
fn retain(&mut self, state: GcRef);
fn abort(&mut self, kind: FaultKind) -> Aborted;
}Expand description
What a walk asks about the graph it is walking.
Every method may fault — the closures are arbitrary Praxis code — so every
answer is a Result. An Err(Aborted) means a fault is already pending on
the context and the walk must stop; it never means “no answer”.
Required Methods§
Sourcefn neighbours(&mut self, state: GcRef) -> Result<Vec<GcRef>, Aborted>
fn neighbours(&mut self, state: GcRef) -> Result<Vec<GcRef>, Aborted>
The states reachable in one step from state.
Sourcefn weight(&mut self, from: GcRef, to: GcRef) -> Result<i64, Aborted>
fn weight(&mut self, from: GcRef, to: GcRef) -> Result<i64, Aborted>
The cost of the edge from from to to. Only called for a pair the
oracle itself reported adjacent.
Sourcefn heuristic(&mut self, state: GcRef) -> Result<i64, Aborted>
fn heuristic(&mut self, state: GcRef) -> Result<i64, Aborted>
The estimated remaining cost from state to a goal.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".