summaryrefslogtreecommitdiffstats
path: root/libimagbookmark
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-07-08 00:11:54 +0200
committerMatthias Beyer <mail@beyermatthias.de>2016-07-08 00:11:54 +0200
commited1eea053acd6766f79fef3a3600e8fff5c24d0e (patch)
tree27878fa74ff1fa815bb8688bc68a84b8c2301672 /libimagbookmark
parentf2cc233c37b002ccecfd8f132998e712fd021c89 (diff)
Impl BookmarkCollection::get()
Diffstat (limited to 'libimagbookmark')
-rw-r--r--libimagbookmark/src/collection.rs16
1 files changed, 14 insertions, 2 deletions
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<BookmarkCollection<'a>> {
- unimplemented!()
+ pub fn get(store: &'a Store, name: &str) -> Result<BookmarkCollection<'a>> {
+ 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<()> {