Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/mft.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmer Ben-Amram <omerbenamram@gmail.com>2019-05-23 18:08:35 +0300
committerOmer Ben-Amram <omerbenamram@gmail.com>2019-05-23 18:08:35 +0300
commitdfb0d9636fe746558347c8f0dc03ea765b09603e (patch)
treece0c083e79cbbdc7856bf4b1bec14d29aa766212
parentd6ecc8c874c08a968074089ddfb50ea0de7dd8c6 (diff)
@ohadravid a better way!
-rw-r--r--src/mft.rs11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/mft.rs b/src/mft.rs
index b95cdbd..020a69c 100644
--- a/src/mft.rs
+++ b/src/mft.rs
@@ -87,17 +87,8 @@ impl<T: ReadSeek> MftParser<T> {
/// Iterates over all the entries in the MFT.
pub fn iter_entries(&mut self) -> impl Iterator<Item = Result<MftEntry>> + '_ {
let total_entries = self.get_entry_count();
- let mut count = 0;
- std::iter::from_fn(move || {
- if count == total_entries {
- None
- } else {
- let entry = Some(self.get_entry(count));
- count += 1;
- entry
- }
- })
+ (0..total_entries).map(move |i| self.get_entry(i))
}
/// Gets the full path for an entry.