summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-01-31 18:34:37 +0100
committerMatthias Beyer <mail@beyermatthias.de>2018-02-01 16:46:38 +0100
commitda0c1fa5948a1174b4d01494531e05abba631166 (patch)
tree79711c7233231d28bbdcc8c979a217bfe1cfe966
parent3c1a0a51c90a130d8cf28cc3d0d8a674548f7ea8 (diff)
downloadimag-da0c1fa5948a1174b4d01494531e05abba631166.zip
imag-da0c1fa5948a1174b4d01494531e05abba631166.tar.gz
Rewrite From<> implementations for habit iterators
to be generic over all iterators over StoreIds, so they can be build directly from them.
-rw-r--r--lib/domain/libimaghabit/src/iter.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/domain/libimaghabit/src/iter.rs b/lib/domain/libimaghabit/src/iter.rs
index 9d5d740..71f7220 100644
--- a/lib/domain/libimaghabit/src/iter.rs
+++ b/lib/domain/libimaghabit/src/iter.rs
@@ -18,6 +18,7 @@
//
use libimagstore::storeid::StoreIdIterator;
+use libimagstore::storeid::StoreIdIteratorWithStore;
use libimagstore::storeid::StoreId;
use util::IsHabitCheck;
@@ -43,6 +44,12 @@ impl From<StoreIdIterator> for HabitTemplateStoreIdIterator {
}
}
+impl<'a> From<StoreIdIteratorWithStore<'a>> for HabitTemplateStoreIdIterator {
+ fn from(sii: StoreIdIteratorWithStore<'a>) -> Self {
+ HabitTemplateStoreIdIterator(sii.without_store())
+ }
+}
+
pub struct HabitInstanceStoreIdIterator(StoreIdIterator);
impl HabitInstanceStoreIdIterator {
@@ -70,3 +77,9 @@ impl From<StoreIdIterator> for HabitInstanceStoreIdIterator {
}
}
+impl<'a> From<StoreIdIteratorWithStore<'a>> for HabitInstanceStoreIdIterator {
+ fn from(sii: StoreIdIteratorWithStore<'a>) -> Self {
+ HabitInstanceStoreIdIterator(sii.without_store())
+ }
+}
+