Fix Eq for Move so that it agrees with Ord, as required.

master
Juergen Stuber 5 years ago
parent a85d69a36c
commit 7bf5bf22d4

@ -191,13 +191,21 @@ impl Board {
}
}
#[derive(PartialEq, Eq)]
#[derive(Debug)]
struct Move {
from: Point2d,
dir: Vec2d,
prio: i32,
}
impl PartialEq for Move {
fn eq(&self, other: &Move) -> bool {
self.prio == other.prio
}
}
impl Eq for Move {}
impl PartialOrd for Move {
fn partial_cmp(&self, other: &Move) -> Option<Ordering> {
self.prio.partial_cmp(&other.prio)

@ -193,13 +193,21 @@ impl Board {
}
}
#[derive(PartialEq, Eq)]
#[derive(Debug)]
struct Move {
from: Point2d,
dir: Vec2d,
prio: i32,
}
impl PartialEq for Move {
fn eq(&self, other: &Move) -> bool {
self.prio == other.prio
}
}
impl Eq for Move {}
impl PartialOrd for Move {
fn partial_cmp(&self, other: &Move) -> Option<Ordering> {
self.prio.partial_cmp(&other.prio)

Loading…
Cancel
Save