Refactor libimagwiki to fit new store iterator interface

This commit is contained in:
Matthias Beyer 2018-04-30 17:28:54 +02:00
parent 715753ed25
commit 40688a3c2d

View file

@ -108,12 +108,15 @@ impl<'a, 'b> Wiki<'a, 'b> {
pub struct WikiIdIterator<'a>(StoreIdIteratorWithStore<'a>, IdIsInWikiFilter<'a>); pub struct WikiIdIterator<'a>(StoreIdIteratorWithStore<'a>, IdIsInWikiFilter<'a>);
impl<'a> Iterator for WikiIdIterator<'a> { impl<'a> Iterator for WikiIdIterator<'a> {
type Item = StoreId; type Item = Result<StoreId>;
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
while let Some(next) = self.0.next() { while let Some(next) = self.0.next() {
if self.1.filter(&next) { match next {
return Some(next) Ok(next) => if self.1.filter(&next) {
return Some(Ok(next));
},
Err(e) => return Some(Err(e).map_err(WE::from)),
} }
} }