From 08114bbf36c723580292f92f8226a38343a68f64 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 30 Apr 2018 17:28:54 +0200 Subject: [PATCH] Refactor libimagnotes to fit new store iterator interface --- lib/domain/libimagnotes/src/iter.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/domain/libimagnotes/src/iter.rs b/lib/domain/libimagnotes/src/iter.rs index 263506c7..98adbbd9 100644 --- a/lib/domain/libimagnotes/src/iter.rs +++ b/lib/domain/libimagnotes/src/iter.rs @@ -21,6 +21,8 @@ use libimagstore::storeid::StoreId; use libimagstore::storeid::StoreIdIterator; use notestoreid::*; +use error::Result; +use error::NoteError as NE; #[derive(Debug)] pub struct NoteIterator(StoreIdIterator); @@ -34,12 +36,15 @@ impl NoteIterator { } impl Iterator for NoteIterator { - type Item = StoreId; + type Item = Result; fn next(&mut self) -> Option { while let Some(n) = self.0.next() { - if n.is_note_id() { - return Some(n); + match n { + Ok(n) => if n.is_note_id() { + return Some(Ok(n)); + }, + Err(e) => return Some(Err(e).map_err(NE::from)), } }