Refactor libimagcontact to fit new store iterator interface

This commit is contained in:
Matthias Beyer 2018-04-30 17:28:54 +02:00
parent a2ff298e67
commit 8f03b4a71a
2 changed files with 7 additions and 3 deletions

View file

@ -43,8 +43,9 @@ impl<'a> Iterator for ContactIter<'a> {
fn next(&mut self) -> Option<Self::Item> {
loop {
match self.0.next() {
None => return None,
Some(sid) => match self.1.get(sid.clone()).map_err(From::from) {
None => return None,
Some(Err(e)) => return Some(Err(e).map_err(CE::from)),
Some(Ok(sid)) => match self.1.get(sid.clone()).map_err(From::from) {
Err(e) => return Some(Err(e)),
Ok(None) => return Some(Err(CE::from_kind(CEK::EntryNotFound(sid)))),
Ok(Some(entry)) => match entry.is_contact().map_err(From::from) {

View file

@ -81,7 +81,10 @@ impl<'a> ContactStore<'a> for Store {
let iter = self
.entries()?
.without_store()
.filter(|id| id.is_in_collection(&["contact"]));
.filter(|id| match *id {
Ok(ref id) => id.is_in_collection(&["contact"]),
Err(_) => true,
});
Ok(StoreIdIterator::new(Box::new(iter)))
}