summaryrefslogtreecommitdiff
path: root/src/cmd/show_gen.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/show_gen.rs')
-rw-r--r--src/cmd/show_gen.rs20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/cmd/show_gen.rs b/src/cmd/show_gen.rs
index ba39809..df8a030 100644
--- a/src/cmd/show_gen.rs
+++ b/src/cmd/show_gen.rs
@@ -21,16 +21,20 @@ impl ShowGeneration {
let genlist = client.list_generations()?;
let gen_id: String = genlist.resolve(&self.gen_id)?;
let gen = client.fetch_generation(&gen_id, temp.path())?;
- let files = gen.files()?;
+ let mut files = gen.files()?;
+ let mut files = files.iter()?;
- let total_bytes = files.iter().fold(0, |acc, file| {
- let e = file.entry();
- if e.kind() == FilesystemKind::Regular {
- acc + file.entry().len()
- } else {
- acc
- }
+ let total_bytes = files.try_fold(0, |acc, file| {
+ file.map(|file| {
+ let e = file.entry();
+ if e.kind() == FilesystemKind::Regular {
+ acc + e.len()
+ } else {
+ acc
+ }
+ })
});
+ let total_bytes = total_bytes?;
println!("generation-id: {}", gen_id);
println!("file-count: {}", gen.file_count()?);