Fix libimagbookmark::collection::* for new StoreId interface

This commit is contained in:
Matthias Beyer 2016-08-25 19:30:05 +02:00
parent f46d4f4dfd
commit 7ac98e1e54

View file

@ -51,8 +51,9 @@ impl<'a> DerefMut for BookmarkCollection<'a> {
impl<'a> BookmarkCollection<'a> { impl<'a> BookmarkCollection<'a> {
pub fn new(store: &'a Store, name: &str) -> Result<BookmarkCollection<'a>> { pub fn new(store: &'a Store, name: &str) -> Result<BookmarkCollection<'a>> {
let id = ModuleEntryPath::new(name).into_storeid(); ModuleEntryPath::new(name)
store.create(id) .into_storeid()
.and_then(|id| store.create(id))
.map(|fle| { .map(|fle| {
BookmarkCollection { BookmarkCollection {
fle: fle, fle: fle,
@ -63,8 +64,9 @@ impl<'a> BookmarkCollection<'a> {
} }
pub fn get(store: &'a Store, name: &str) -> Result<BookmarkCollection<'a>> { pub fn get(store: &'a Store, name: &str) -> Result<BookmarkCollection<'a>> {
let id = ModuleEntryPath::new(name).into_storeid(); ModuleEntryPath::new(name)
store.get(id) .into_storeid()
.and_then(|id| store.get(id))
.map_err_into(BEK::StoreReadError) .map_err_into(BEK::StoreReadError)
.and_then(|fle| { .and_then(|fle| {
match fle { match fle {
@ -78,7 +80,10 @@ impl<'a> BookmarkCollection<'a> {
} }
pub fn delete(store: &Store, name: &str) -> Result<()> { 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>> { pub fn links(&self) -> Result<Vec<Url>> {