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

@ -44,7 +44,8 @@ impl<'a> Iterator for ContactIter<'a> {
loop { loop {
match self.0.next() { match self.0.next() {
None => return None, None => return None,
Some(sid) => match self.1.get(sid.clone()).map_err(From::from) { 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)), Err(e) => return Some(Err(e)),
Ok(None) => return Some(Err(CE::from_kind(CEK::EntryNotFound(sid)))), Ok(None) => return Some(Err(CE::from_kind(CEK::EntryNotFound(sid)))),
Ok(Some(entry)) => match entry.is_contact().map_err(From::from) { 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 let iter = self
.entries()? .entries()?
.without_store() .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))) Ok(StoreIdIterator::new(Box::new(iter)))
} }