diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2019-02-04 00:24:39 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2019-02-11 03:22:56 +0100 |
commit | c29e05bc2583d5126f3100d3d7908f742143155f (patch) | |
tree | 88cd743f4c12dc7cdf0f93189aa7001edf5b8dd5 /lib | |
parent | eed577db15d5dbeee1496e218142c14466df8d66 (diff) |
Simplify implementation of ContactStore::all_contacts()
This way we alter the underlying iterator for all contacts to only
iterate in the "contact" collection of the store, which results in fewer
disk access because the internal iterator does not yield all pathes from
the store before filtering them.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/domain/libimagcontact/src/store.rs | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/lib/domain/libimagcontact/src/store.rs b/lib/domain/libimagcontact/src/store.rs index dc2fa5a5..b39d4e04 100644 --- a/lib/domain/libimagcontact/src/store.rs +++ b/lib/domain/libimagcontact/src/store.rs @@ -77,15 +77,7 @@ impl<'a> ContactStore<'a> for Store { } fn all_contacts(&'a self) -> Result<StoreIdIterator> { - let iter = self - .entries()? - .without_store() - .filter(|id| match *id { - Ok(ref id) => id.is_in_collection(&["contact"]), - Err(_) => true, - }); - - Ok(StoreIdIterator::new(Box::new(iter))) + self.entries().map(|iter| iter.in_collection("contact").without_store()) } } |