From d141a3670f9b52e75b7f67ef4b2e4ecd6baddc4e Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 2 Dec 2015 11:42:06 +0100 Subject: [PATCH] Add StorageBackend::iter_files() --- src/storage/backend.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/storage/backend.rs b/src/storage/backend.rs index 7c413b24..b2a3c499 100644 --- a/src/storage/backend.rs +++ b/src/storage/backend.rs @@ -73,6 +73,17 @@ impl StorageBackend { }).ok() } + pub fn iter_files<'a, HP>(&self, m: &'a Module, p: &Parser) + -> Option>> + where HP: FileHeaderParser + { + self.iter_ids(m).and_then(|ids| { + Some(ids.filter_map(|id| self.get_file_by_id(m, &id, p)) + .collect::>() + .into_iter()) + }) + } + /* * Write a file to disk. *