summaryrefslogtreecommitdiffstats
path: root/libimagbookmark
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-09-05 16:10:47 +0200
committerGitHub <noreply@github.com>2016-09-05 16:10:47 +0200
commit737aab80dc029315d412ff781f20e9afd8db55ae (patch)
tree44d36cca30efa87b6964c185c46f75a7bd2fb043 /libimagbookmark
parentdfcc5c6a0e5bde7c5ed3ba40e3f6376b9e7d0a96 (diff)
parent07d4c45b3f21f07416f3d19bde122f11095467b4 (diff)
Merge pull request #667 from matthiasbeyer/rewrite-storeid-type
Rewrite storeid type
Diffstat (limited to 'libimagbookmark')
-rw-r--r--libimagbookmark/src/collection.rs15
-rw-r--r--libimagbookmark/src/lib.rs2
2 files changed, 11 insertions, 6 deletions
diff --git a/libimagbookmark/src/collection.rs b/libimagbookmark/src/collection.rs
index b7fc4459..b2cde9ef 100644
--- a/libimagbookmark/src/collection.rs
+++ b/libimagbookmark/src/collection.rs
@@ -51,8 +51,9 @@ impl<'a> DerefMut for BookmarkCollection<'a> {
impl<'a> BookmarkCollection<'a> {
pub fn new(store: &'a Store, name: &str) -> Result<BookmarkCollection<'a>> {
- let id = ModuleEntryPath::new(name).into_storeid();
- store.create(id)
+ ModuleEntryPath::new(name)
+ .into_storeid()
+ .and_then(|id| store.create(id))
.map(|fle| {
BookmarkCollection {
fle: fle,
@@ -63,8 +64,9 @@ impl<'a> BookmarkCollection<'a> {
}
pub fn get(store: &'a Store, name: &str) -> Result<BookmarkCollection<'a>> {
- let id = ModuleEntryPath::new(name).into_storeid();
- store.get(id)
+ ModuleEntryPath::new(name)
+ .into_storeid()
+ .and_then(|id| store.get(id))
.map_err_into(BEK::StoreReadError)
.and_then(|fle| {
match fle {
@@ -78,7 +80,10 @@ impl<'a> BookmarkCollection<'a> {
}
pub fn delete(store: &Store, name: &str) -> Result<()> {
- store.delete(ModuleEntryPath::new(name).into_storeid()).map_err_into(BEK::StoreReadError)
+ ModuleEntryPath::new(name)
+ .into_storeid()
+ .and_then(|id| store.delete(id))
+ .map_err_into(BEK::StoreReadError)
}
pub fn links(&self) -> Result<Vec<Url>> {
diff --git a/libimagbookmark/src/lib.rs b/libimagbookmark/src/lib.rs
index 5b0a82ef..bc98b061 100644
--- a/libimagbookmark/src/lib.rs
+++ b/libimagbookmark/src/lib.rs
@@ -21,7 +21,7 @@ extern crate regex;
#[macro_use] extern crate libimagerror;
extern crate libimagentrylink;
-module_entry_path_mod!("bookmark", "0.1.0");
+module_entry_path_mod!("bookmark");
pub mod collection;
pub mod error;