Impl BookmarkCollection::get()

This commit is contained in:
Matthias Beyer 2016-07-08 00:11:54 +02:00
parent f2cc233c37
commit ed1eea053a

View file

@ -19,6 +19,7 @@ use libimagstore::store::FileLockEntry;
use libimagentrylink::external::ExternalLinker; use libimagentrylink::external::ExternalLinker;
use libimagentrylink::internal::InternalLinker; use libimagentrylink::internal::InternalLinker;
use libimagentrylink::internal::Link; use libimagentrylink::internal::Link;
use libimagerror::into::IntoError;
use url::Url; use url::Url;
pub struct BookmarkCollection<'a> { pub struct BookmarkCollection<'a> {
@ -58,8 +59,19 @@ impl<'a> BookmarkCollection<'a> {
.map_err_into(BEK::StoreReadError) .map_err_into(BEK::StoreReadError)
} }
pub fn open(store: &Store, name: &str) -> Result<BookmarkCollection<'a>> { pub fn get(store: &'a Store, name: &str) -> Result<BookmarkCollection<'a>> {
unimplemented!() let id = ModuleEntryPath::new(name).into_storeid();
store.get(id)
.map_err_into(BEK::StoreReadError)
.and_then(|fle| {
match fle {
None => Err(BEK::CollectionNotFound.into_error()),
Some(e) => Ok(BookmarkCollection {
fle: e,
store: store,
}),
}
})
} }
pub fn delete(store: &Store, name: &str) -> Result<()> { pub fn delete(store: &Store, name: &str) -> Result<()> {