From b388c6684e09bd9b3c92171d9220e825542431af Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 18 Apr 2016 19:52:14 +0200 Subject: [PATCH] Add Viewer Trait --- libimagentryview/src/viewer.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 libimagentryview/src/viewer.rs diff --git a/libimagentryview/src/viewer.rs b/libimagentryview/src/viewer.rs new file mode 100644 index 00000000..72ffbd7d --- /dev/null +++ b/libimagentryview/src/viewer.rs @@ -0,0 +1,17 @@ +use libimagstore::store::Entry; + +use result::Result; + +pub trait Viewer { + + fn view_entry(&self, e: &Entry) -> Result<()>; + + fn view_entries>(&self, entries: I) -> Result<()> { + for entry in entries { + if let Err(e) = self.view_entry(&entry) { + return Err(e); + } + } + Ok(()) + } +}