From ed1eea053acd6766f79fef3a3600e8fff5c24d0e Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 8 Jul 2016 00:11:54 +0200 Subject: Impl BookmarkCollection::get() --- libimagbookmark/src/collection.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'libimagbookmark') diff --git a/libimagbookmark/src/collection.rs b/libimagbookmark/src/collection.rs index 3316d562..593990a5 100644 --- a/libimagbookmark/src/collection.rs +++ b/libimagbookmark/src/collection.rs @@ -19,6 +19,7 @@ use libimagstore::store::FileLockEntry; use libimagentrylink::external::ExternalLinker; use libimagentrylink::internal::InternalLinker; use libimagentrylink::internal::Link; +use libimagerror::into::IntoError; use url::Url; pub struct BookmarkCollection<'a> { @@ -58,8 +59,19 @@ impl<'a> BookmarkCollection<'a> { .map_err_into(BEK::StoreReadError) } - pub fn open(store: &Store, name: &str) -> Result> { - unimplemented!() + pub fn get(store: &'a Store, name: &str) -> Result> { + 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<()> { -- cgit v1.2.3