diff options
author | Thomas Hurst <tom@hur.st> | 2020-07-01 20:28:38 +0000 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-07-02 06:44:12 +0800 |
commit | 1d8ba524ac83a0c3b5e4146cf937ed75650f1e97 (patch) | |
tree | 82852377479372a176a8b5491dea22e999b6ec6b /src/interactive/widgets | |
parent | c37ee449f32ed3af0fc222f669ae3f40859d8a39 (diff) |
Use u128 for byte sizes
Per issue #58, u64 is insufficient for use with very large sparse files.
Enormous file sizes are also a common filesystem error trope, either
from disk corruption or software bugs, and they're also conceivable with
virtual filesystems.
Handle this as gracefully as can be reasonably expected using 128-bit
integers, which should be sufficient for most uses.
Diffstat (limited to 'src/interactive/widgets')
-rw-r--r-- | src/interactive/widgets/entries.rs | 2 | ||||
-rw-r--r-- | src/interactive/widgets/footer.rs | 2 | ||||
-rw-r--r-- | src/interactive/widgets/mark.rs | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/interactive/widgets/entries.rs b/src/interactive/widgets/entries.rs index fc68f44..279a7fa 100644 --- a/src/interactive/widgets/entries.rs +++ b/src/interactive/widgets/entries.rs @@ -60,7 +60,7 @@ impl Entries { .is_none() }; - let total: u64 = entries.iter().map(|b| b.data.size).sum(); + let total: u128 = entries.iter().map(|b| b.data.size).sum(); let title = match path_of(tree, *root).to_string_lossy().to_string() { ref p if p.is_empty() => Path::new(".") .canonicalize() diff --git a/src/interactive/widgets/footer.rs b/src/interactive/widgets/footer.rs index 461580c..190c6c9 100644 --- a/src/interactive/widgets/footer.rs +++ b/src/interactive/widgets/footer.rs @@ -11,7 +11,7 @@ use tui::{ pub struct Footer; pub struct FooterProps { - pub total_bytes: Option<u64>, + pub total_bytes: Option<u128>, pub entries_traversed: u64, pub format: ByteFormat, pub message: Option<String>, diff --git a/src/interactive/widgets/mark.rs b/src/interactive/widgets/mark.rs index 1f59738..3c26a3a 100644 --- a/src/interactive/widgets/mark.rs +++ b/src/interactive/widgets/mark.rs @@ -31,7 +31,7 @@ pub enum MarkMode { pub type EntryMarkMap = BTreeMap<TreeIndex, EntryMark>; pub struct EntryMark { - pub size: u64, + pub size: u128, pub path: PathBuf, pub index: usize, pub num_errors_during_deletion: usize, @@ -230,7 +230,7 @@ impl MarkPane { let title = format!( "Marked {} items ({}) ", marked.len(), - format.display(marked.iter().map(|(_k, v)| v.size).sum::<u64>()) + format.display(marked.iter().map(|(_k, v)| v.size).sum::<u128>()) ); let selected = self.selected; let has_focus = self.has_focus; |