1use std::cmp::Ordering;
2
3#[derive(Copy, Clone, Debug)]
7pub struct NodeCost<Node, Cost> {
8 pub node: Node,
9 pub cost: Cost,
10}
11
12impl<Node, Cost> NodeCost<Node, Cost> {
13 pub const fn new(node: Node, cost: Cost) -> Self {
17 Self { node, cost }
18 }
19}
20
21impl<Node, Cost> Ord for NodeCost<Node, Cost>
22where
23 Cost: Ord,
24{
25 fn cmp(&self, other: &Self) -> Ordering {
26 self.cost.cmp(&other.cost)
27 }
28}
29
30impl<Node, Cost> PartialOrd for NodeCost<Node, Cost>
31where
32 Cost: PartialOrd,
33{
34 fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
35 self.cost.partial_cmp(&other.cost)
36 }
37}
38
39impl<Node, Cost> Eq for NodeCost<Node, Cost> where Cost: Eq {}
40
41impl<Node, Cost> PartialEq for NodeCost<Node, Cost>
42where
43 Cost: PartialEq,
44{
45 fn eq(&self, other: &Self) -> bool {
46 self.cost.eq(&other.cost)
47 }
48}