Refactor imag-diary to new store iterator interface

This commit is contained in:
Matthias Beyer 2018-05-01 17:42:47 +02:00
parent 829e425c12
commit 11f9a9027e
2 changed files with 4 additions and 1 deletions

View file

@ -23,6 +23,7 @@ use libimagdiary::diary::Diary;
use libimagrt::runtime::Runtime; use libimagrt::runtime::Runtime;
use libimagutil::warn_exit::warn_exit; use libimagutil::warn_exit::warn_exit;
use libimagerror::trace::MapErrTrace; use libimagerror::trace::MapErrTrace;
use libimagerror::iter::TraceIterator;
use libimagerror::io::ToExitCode; use libimagerror::io::ToExitCode;
use libimagerror::exit::ExitUnwrap; use libimagerror::exit::ExitUnwrap;
use libimagutil::debug_result::*; use libimagutil::debug_result::*;
@ -40,6 +41,7 @@ pub fn list(rt: &Runtime) {
let mut ids = Diary::entries(rt.store(), &diaryname) let mut ids = Diary::entries(rt.store(), &diaryname)
.map_dbg_str("Ok") .map_dbg_str("Ok")
.map_err_trace_exit_unwrap(1) .map_err_trace_exit_unwrap(1)
.trace_unwrap_exit(1)
.map(|id| DiaryId::from_storeid(&id)) .map(|id| DiaryId::from_storeid(&id))
.collect::<Result<Vec<_>>>() .collect::<Result<Vec<_>>>()
.map_err_trace_exit_unwrap(1); .map_err_trace_exit_unwrap(1);

View file

@ -21,6 +21,7 @@ use libimagdiary::diary::Diary;
use libimagdiary::viewer::DiaryViewer as DV; use libimagdiary::viewer::DiaryViewer as DV;
use libimagrt::runtime::Runtime; use libimagrt::runtime::Runtime;
use libimagerror::trace::MapErrTrace; use libimagerror::trace::MapErrTrace;
use libimagerror::iter::TraceIterator;
use libimagutil::warn_exit::warn_exit; use libimagutil::warn_exit::warn_exit;
use libimagstore::iter::get::StoreIdGetIteratorExtension; use libimagstore::iter::get::StoreIdGetIteratorExtension;
use libimagentryview::viewer::Viewer; use libimagentryview::viewer::Viewer;
@ -34,7 +35,7 @@ pub fn view(rt: &Runtime) {
let entries = Diary::entries(rt.store(), &diaryname) let entries = Diary::entries(rt.store(), &diaryname)
.map_err_trace_exit_unwrap(1) .map_err_trace_exit_unwrap(1)
.into_get_iter(rt.store()) .into_get_iter(rt.store())
.filter_map(Result::ok) .trace_unwrap_exit(1)
.map(|e| e.unwrap_or_else(|| { .map(|e| e.unwrap_or_else(|| {
error!("Failed to fetch entry"); error!("Failed to fetch entry");
::std::process::exit(1) ::std::process::exit(1)