|
20 | 20 | //! the field `next_edge`). Each of those fields is an array that should
|
21 | 21 | //! be indexed by the direction (see the type `Direction`).
|
22 | 22 |
|
23 |
| -use bit_set::BitSet; |
| 23 | +use crate::bit_set::BitSet; |
| 24 | +use crate::snapshot_vec::{SnapshotVec, SnapshotVecDelegate}; |
24 | 25 | use std::fmt::Debug;
|
25 | 26 | use std::usize;
|
26 |
| -use snapshot_vec::{SnapshotVec, SnapshotVecDelegate}; |
27 | 27 |
|
28 | 28 | #[cfg(test)]
|
29 | 29 | mod tests;
|
@@ -212,15 +212,19 @@ impl<N: Debug, E: Debug> Graph<N, E> {
|
212 | 212 | .all(|(edge_idx, edge)| f(edge_idx, edge))
|
213 | 213 | }
|
214 | 214 |
|
215 |
| - pub fn outgoing_edges(&self, source: NodeIndex) -> AdjacentEdges<N, E> { |
| 215 | + pub fn outgoing_edges(&self, source: NodeIndex) -> AdjacentEdges<'_, N, E> { |
216 | 216 | self.adjacent_edges(source, OUTGOING)
|
217 | 217 | }
|
218 | 218 |
|
219 |
| - pub fn incoming_edges(&self, source: NodeIndex) -> AdjacentEdges<N, E> { |
| 219 | + pub fn incoming_edges(&self, source: NodeIndex) -> AdjacentEdges<'_, N, E> { |
220 | 220 | self.adjacent_edges(source, INCOMING)
|
221 | 221 | }
|
222 | 222 |
|
223 |
| - pub fn adjacent_edges(&self, source: NodeIndex, direction: Direction) -> AdjacentEdges<N, E> { |
| 223 | + pub fn adjacent_edges( |
| 224 | + &self, |
| 225 | + source: NodeIndex, |
| 226 | + direction: Direction |
| 227 | + ) -> AdjacentEdges<'_, N, E> { |
224 | 228 | let first_edge = self.node(source).first_edge[direction.repr];
|
225 | 229 | AdjacentEdges {
|
226 | 230 | graph: self,
|
@@ -291,11 +295,7 @@ impl<N: Debug, E: Debug> Graph<N, E> {
|
291 | 295 |
|
292 | 296 | // # Iterators
|
293 | 297 |
|
294 |
| -pub struct AdjacentEdges<'g, N, E> |
295 |
| -where |
296 |
| - N: 'g, |
297 |
| - E: 'g, |
298 |
| -{ |
| 298 | +pub struct AdjacentEdges<'g, N, E> { |
299 | 299 | graph: &'g Graph<N, E>,
|
300 | 300 | direction: Direction,
|
301 | 301 | next: EdgeIndex,
|
@@ -331,11 +331,7 @@ impl<'g, N: Debug, E: Debug> Iterator for AdjacentEdges<'g, N, E> {
|
331 | 331 | }
|
332 | 332 | }
|
333 | 333 |
|
334 |
| -pub struct DepthFirstTraversal<'g, N, E> |
335 |
| -where |
336 |
| - N: 'g, |
337 |
| - E: 'g, |
338 |
| -{ |
| 334 | +pub struct DepthFirstTraversal<'g, N, E> { |
339 | 335 | graph: &'g Graph<N, E>,
|
340 | 336 | stack: Vec<NodeIndex>,
|
341 | 337 | visited: BitSet<usize>,
|
|
0 commit comments