Refactor libimagcontact to fit new store iterator interface
This commit is contained in:
parent
a2ff298e67
commit
8f03b4a71a
2 changed files with 7 additions and 3 deletions
|
@ -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) {
|
||||||
|
|
|
@ -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)))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue