Refactor imag-diary to new store iterator interface
This commit is contained in:
parent
829e425c12
commit
11f9a9027e
2 changed files with 4 additions and 1 deletions
|
@ -23,6 +23,7 @@ use libimagdiary::diary::Diary;
|
|||
use libimagrt::runtime::Runtime;
|
||||
use libimagutil::warn_exit::warn_exit;
|
||||
use libimagerror::trace::MapErrTrace;
|
||||
use libimagerror::iter::TraceIterator;
|
||||
use libimagerror::io::ToExitCode;
|
||||
use libimagerror::exit::ExitUnwrap;
|
||||
use libimagutil::debug_result::*;
|
||||
|
@ -40,6 +41,7 @@ pub fn list(rt: &Runtime) {
|
|||
let mut ids = Diary::entries(rt.store(), &diaryname)
|
||||
.map_dbg_str("Ok")
|
||||
.map_err_trace_exit_unwrap(1)
|
||||
.trace_unwrap_exit(1)
|
||||
.map(|id| DiaryId::from_storeid(&id))
|
||||
.collect::<Result<Vec<_>>>()
|
||||
.map_err_trace_exit_unwrap(1);
|
||||
|
|
|
@ -21,6 +21,7 @@ use libimagdiary::diary::Diary;
|
|||
use libimagdiary::viewer::DiaryViewer as DV;
|
||||
use libimagrt::runtime::Runtime;
|
||||
use libimagerror::trace::MapErrTrace;
|
||||
use libimagerror::iter::TraceIterator;
|
||||
use libimagutil::warn_exit::warn_exit;
|
||||
use libimagstore::iter::get::StoreIdGetIteratorExtension;
|
||||
use libimagentryview::viewer::Viewer;
|
||||
|
@ -34,7 +35,7 @@ pub fn view(rt: &Runtime) {
|
|||
let entries = Diary::entries(rt.store(), &diaryname)
|
||||
.map_err_trace_exit_unwrap(1)
|
||||
.into_get_iter(rt.store())
|
||||
.filter_map(Result::ok)
|
||||
.trace_unwrap_exit(1)
|
||||
.map(|e| e.unwrap_or_else(|| {
|
||||
error!("Failed to fetch entry");
|
||||
::std::process::exit(1)
|
||||
|
|
Loading…
Reference in a new issue