diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-05-23 19:16:05 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-05-23 19:18:06 +0200 |
commit | 38031d5798d385eb2521e48f350509b97a3dd1b1 (patch) | |
tree | 4cf03741401ada532d72f46798d06091399b8de3 | |
parent | 63dd1ca6f7e83ef79ff80728e7188692540fbb48 (diff) |
Add counter in libimagentrylist::listers::Core
-rw-r--r-- | libimagentrylist/src/listers/core.rs | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/libimagentrylist/src/listers/core.rs b/libimagentrylist/src/listers/core.rs index 8c7ccf72..50913258 100644 --- a/libimagentrylist/src/listers/core.rs +++ b/libimagentrylist/src/listers/core.rs @@ -27,12 +27,19 @@ impl<'a> Lister for CoreLister<'a> { use error::ListError as LE; use error::ListErrorKind as LEK; - entries.fold(Ok(()), |accu, entry| { - accu.and_then(|_| { - write!(stdout(), "{:?}\n", (self.lister)(&entry)) - .map_err(|e| LE::new(LEK::FormatError, Some(Box::new(e)))) - }) - }) + debug!("Called list()"); + let (r, n) = entries + .fold((Ok(()), 0), |(accu, i), entry| { + debug!("fold({:?}, {:?})", accu, entry); + let r = accu.and_then(|_| { + debug!("Listing Entry: {:?}", entry); + write!(stdout(), "{:?}\n", (self.lister)(&entry)) + .map_err(|e| LE::new(LEK::FormatError, Some(Box::new(e)))) + }); + (r, i + 1) + }); + debug!("Iterated over {} entries", n); + r } } |