Refactor libimagnotes to fit new store iterator interface
This commit is contained in:
parent
e643f36fa3
commit
08114bbf36
1 changed files with 8 additions and 3 deletions
|
@ -21,6 +21,8 @@ use libimagstore::storeid::StoreId;
|
||||||
use libimagstore::storeid::StoreIdIterator;
|
use libimagstore::storeid::StoreIdIterator;
|
||||||
|
|
||||||
use notestoreid::*;
|
use notestoreid::*;
|
||||||
|
use error::Result;
|
||||||
|
use error::NoteError as NE;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct NoteIterator(StoreIdIterator);
|
pub struct NoteIterator(StoreIdIterator);
|
||||||
|
@ -34,12 +36,15 @@ impl NoteIterator {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Iterator for NoteIterator {
|
impl Iterator for NoteIterator {
|
||||||
type Item = StoreId;
|
type Item = Result<StoreId>;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
while let Some(n) = self.0.next() {
|
while let Some(n) = self.0.next() {
|
||||||
if n.is_note_id() {
|
match n {
|
||||||
return Some(n);
|
Ok(n) => if n.is_note_id() {
|
||||||
|
return Some(Ok(n));
|
||||||
|
},
|
||||||
|
Err(e) => return Some(Err(e).map_err(NE::from)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue