diff options
author | Sebastian Thiel <sthiel@thoughtworks.com> | 2019-06-03 10:50:12 +0530 |
---|---|---|
committer | Sebastian Thiel <sthiel@thoughtworks.com> | 2019-06-03 10:50:12 +0530 |
commit | dcf3a2651b79493964feb16d8a2148e851a7b4ca (patch) | |
tree | 431dbf153312dbd74d98df01d426710181e8670e /src/common.rs | |
parent | 1f482aab49a9094234d422b3599858e909c3f164 (diff) |
Assure root size is properly computed
Diffstat (limited to 'src/common.rs')
-rw-r--r-- | src/common.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/common.rs b/src/common.rs index 86e5ac4..11f7d7f 100644 --- a/src/common.rs +++ b/src/common.rs @@ -1,7 +1,14 @@ +use crate::interactive::{Tree, TreeIndex}; use jwalk::WalkDir; use std::fmt; use std::path::Path; +pub(crate) fn get_size_or_panic(tree: &Tree, node_idx: TreeIndex) -> u64 { + tree.node_weight(node_idx) + .expect("node should always be retrievable with valid index") + .size +} + /// Specifies a way to format bytes #[derive(Clone, Copy)] pub enum ByteFormat { |