Rewrite to not use Store::retrieve_for_module()
This commit is contained in:
parent
2c52957b63
commit
5666ef12d0
3 changed files with 13 additions and 9 deletions
|
@ -134,9 +134,9 @@ impl Diary for Store {
|
||||||
|
|
||||||
/// Get all diary names
|
/// Get all diary names
|
||||||
fn diary_names(&self) -> Result<DiaryNameIterator> {
|
fn diary_names(&self) -> Result<DiaryNameIterator> {
|
||||||
self.retrieve_for_module("diary")
|
self.entries()
|
||||||
.chain_err(|| DEK::StoreReadError)
|
.map(|it| DiaryNameIterator::new(it.without_store()))
|
||||||
.map(DiaryNameIterator::new)
|
.map_err(::error::DiaryError::from)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ error_chain! {
|
||||||
}
|
}
|
||||||
|
|
||||||
links {
|
links {
|
||||||
|
StoreError(::libimagstore::error::StoreError, ::libimagstore::error::StoreErrorKind);
|
||||||
EntryUtilError(::libimagentryutil::error::EntryUtilError, ::libimagentryutil::error::EntryUtilErrorKind);
|
EntryUtilError(::libimagentryutil::error::EntryUtilError, ::libimagentryutil::error::EntryUtilErrorKind);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,18 +140,21 @@ impl Iterator for DiaryNameIterator {
|
||||||
type Item = Result<String>;
|
type Item = Result<String>;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
self.0
|
while let Some(next) = self.0.next() {
|
||||||
.next()
|
if next.is_in_collection(&["diary"]) {
|
||||||
.map(|s| {
|
return Some(next
|
||||||
s.to_str()
|
.to_str()
|
||||||
.chain_err(|| DEK::DiaryNameFindingError)
|
.chain_err(|| DEK::DiaryNameFindingError)
|
||||||
.and_then(|s| {
|
.and_then(|s| {
|
||||||
s.split("diary/")
|
s.split("diary/")
|
||||||
.nth(1)
|
.nth(1)
|
||||||
.and_then(|n| n.split("/").nth(0).map(String::from))
|
.and_then(|n| n.split("/").nth(0).map(String::from))
|
||||||
.ok_or(DE::from_kind(DEK::DiaryNameFindingError))
|
.ok_or(DE::from_kind(DEK::DiaryNameFindingError))
|
||||||
})
|
}))
|
||||||
})
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue