Add entry getter function

This commit is contained in:
Matthias Beyer 2018-04-10 22:41:46 +02:00
parent c242a362e4
commit 2b8a83d9a7

View file

@ -39,6 +39,12 @@ impl<'a, 'b> Wiki<'a, 'b> {
Wiki(store, name)
}
pub fn get_entry<EN: AsRef<str>>(&self, entry_name: EN) -> Result<Option<FileLockEntry<'a>>> {
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<EN: AsRef<str>>(&self, entry_name: EN) -> Result<FileLockEntry<'a>> {
let path = PathBuf::from(format!("{}/{}", self.1, entry_name.as_ref()));
let sid = ::module_path::ModuleEntryPath::new(path).into_storeid()?;