Rewrite From<> implementations for habit iterators

to be generic over all iterators over StoreIds, so they can be build
directly from them.
This commit is contained in:
Matthias Beyer 2018-01-31 18:34:37 +01:00
parent 3c1a0a51c9
commit da0c1fa594

View file

@ -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())
}
}