From 2b8a83d9a7c24a374fe2c9c29d4cd6e3768157dd Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 10 Apr 2018 22:41:46 +0200 Subject: [PATCH] Add entry getter function --- lib/domain/libimagwiki/src/wiki.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/domain/libimagwiki/src/wiki.rs b/lib/domain/libimagwiki/src/wiki.rs index 56554a15..8b22617e 100644 --- a/lib/domain/libimagwiki/src/wiki.rs +++ b/lib/domain/libimagwiki/src/wiki.rs @@ -39,6 +39,12 @@ impl<'a, 'b> Wiki<'a, 'b> { Wiki(store, name) } + pub fn get_entry>(&self, entry_name: EN) -> Result>> { + let path = PathBuf::from(format!("{}/{}", self.1, entry_name.as_ref())); + let sid = ::module_path::ModuleEntryPath::new(path).into_storeid()?; + self.0.get(sid).map_err(WE::from) + } + pub fn create_entry>(&self, entry_name: EN) -> Result> { let path = PathBuf::from(format!("{}/{}", self.1, entry_name.as_ref())); let sid = ::module_path::ModuleEntryPath::new(path).into_storeid()?;