Skip to content

Commit e4bec85

Browse files
committed
Done Rust API Guidelines C-COMMON-TRAITS
1 parent a54cf12 commit e4bec85

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl<T: Display + Eq + Hash> Graph<T> {
119119

120120
/// Structure to store the shortest path and distance from one node
121121
/// to other nodes after a pathfinding algorithm has been run on a graph.
122-
#[derive(Debug, Eq, PartialEq)]
122+
#[derive(Eq, PartialEq, Debug)]
123123
pub struct ShortestPathTree<T: Display + Clone + Hash + Eq> {
124124
source: T,
125125
results: HashMap<T, Option<(i32, ShortestPath<T>)>>,
@@ -212,7 +212,7 @@ impl<T: Display + Clone + Eq + Hash> ShortestPathTree<T> {
212212
}
213213

214214
/// The shortest path from one node to another.
215-
#[derive(Debug, Eq, PartialEq, Clone)]
215+
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
216216
pub struct ShortestPath<T: Display + Clone> {// Add documentation
217217
/// Contains a list of node ids, first entry is the start node, last entry is the target node.
218218
path: Vec<T>, //TODO maybe add later that the distance between each node is stored as well
@@ -374,7 +374,7 @@ impl<T: Display + Clone + Eq> TryFrom<&Rc<RefCell<Node<T>>>> for ShortestPath<T>
374374
}
375375
}
376376

377-
#[derive(Debug, PartialEq, Eq)]
377+
#[derive(Clone, Eq, PartialEq, PartialOrd, Ord, Hash, Debug)]
378378
/// Errors that can occur when edges are added to the graph.
379379
///
380380
/// Variants specify what exact node is missing.

0 commit comments

Comments
 (0)