diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2018-04-30 17:28:54 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2018-05-01 17:44:01 +0200 |
commit | 715753ed25b319e7cc88695d743659c38a40837b (patch) | |
tree | bac8d6cbc2a7726bd856473827861596f69c7cc4 /lib | |
parent | 72c83ae3f73226f7e93675cddede7c8d0dbe3869 (diff) |
Refactor libimagtodo to fit new store iterator interface
Diffstat (limited to 'lib')
-rw-r--r-- | lib/domain/libimagtodo/src/iter.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/domain/libimagtodo/src/iter.rs b/lib/domain/libimagtodo/src/iter.rs index c2871c5a..c5c63943 100644 --- a/lib/domain/libimagtodo/src/iter.rs +++ b/lib/domain/libimagtodo/src/iter.rs @@ -20,6 +20,9 @@ use libimagstore::storeid::StoreIdIterator; use libimagstore::storeid::StoreId; +use error::Result; +use error::TodoError as TE; + pub struct TaskIdIterator(StoreIdIterator); impl TaskIdIterator { @@ -31,14 +34,15 @@ impl TaskIdIterator { } impl Iterator for TaskIdIterator { - type Item = StoreId; + type Item = Result<StoreId>; fn next(&mut self) -> Option<Self::Item> { loop { match self.0.next() { None => return None, - Some(n) => if n.is_in_collection(&["todo", "taskwarrior"]) { - return Some(n) + Some(Err(e)) => return Some(Err(e).map_err(TE::from)), + Some(Ok(n)) => if n.is_in_collection(&["todo", "taskwarrior"]) { + return Some(Ok(n)) }, // else continue } } |