summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Thiel <sthiel@thoughtworks.com>2019-06-15 14:40:05 +0800
committerSebastian Thiel <sthiel@thoughtworks.com>2019-06-15 14:40:05 +0800
commita3627c8d04b2a755a1e466745c84591ae8e9033b (patch)
tree2539a27461b9f3b828b7a8afe9cc1c4826820c21
parent0fb99e00453da6d63cc01af64fdab8419314763b (diff)
Usage of StableGraph fixes logic thus far
-rw-r--r--src/common.rs2
-rw-r--r--src/traverse.rs5
2 files changed, 3 insertions, 4 deletions
diff --git a/src/common.rs b/src/common.rs
index cc499c6..45f944d 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -1,7 +1,7 @@
use crate::traverse::{EntryData, Tree, TreeIndex};
use byte_unit::{n_gb_bytes, n_gib_bytes, n_mb_bytes, n_mib_bytes, ByteUnit};
use jwalk::WalkDir;
-use std::{fmt, path::Path, path::PathBuf};
+use std::{fmt, path::Path};
pub fn get_entry_or_panic(tree: &Tree, node_idx: TreeIndex) -> &EntryData {
tree.node_weight(node_idx)
diff --git a/src/traverse.rs b/src/traverse.rs
index dc28579..5665bff 100644
--- a/src/traverse.rs
+++ b/src/traverse.rs
@@ -1,11 +1,10 @@
use crate::{get_size_or_panic, WalkOptions};
use failure::Error;
-use petgraph::graph::NodeIndex;
-use petgraph::{Directed, Direction, Graph};
+use petgraph::{graph::NodeIndex, stable_graph::StableGraph, Directed, Direction};
use std::{ffi::OsString, path::PathBuf, time::Duration, time::Instant};
pub type TreeIndex = NodeIndex;
-pub type Tree = Graph<EntryData, (), Directed>;
+pub type Tree = StableGraph<EntryData, (), Directed>;
#[derive(Eq, PartialEq, Debug, Default, Clone)]
pub struct EntryData {